backport a753c1342: Clean up Query cache handling, remove useless timeouts

the timeout was entirely useless, because:
- when shorter than 25.6 seconds (512 ticks) it would cause caches to be needlessly destroyed and regenerated
- when longer than 25.6 seconds, just made outdated caches persist for longer, even after the query info was regenerated.

This now uses a mark-dirty model to deal with caches, which means that plugin modifications to the query data will be reflected immediately, regardless of when they are made. Previously, modifying the result of Server->getQueryInformation() would have inconsistent results.
This commit is contained in:
Dylan K. Taylor
2019-03-24 17:42:41 +00:00
parent dbf4054b1f
commit 60b183b0d9
3 changed files with 36 additions and 33 deletions

View File

@ -1719,7 +1719,7 @@ class Server{
register_shutdown_function([$this, "crashDump"]);
$this->queryRegenerateTask = new QueryRegenerateEvent($this, 5);
$this->queryRegenerateTask = new QueryRegenerateEvent($this);
$this->pluginManager->loadPlugins($this->pluginPath);
@ -2591,10 +2591,7 @@ class Server{
}
if(($this->tickCounter & 0b111111111) === 0){
($this->queryRegenerateTask = new QueryRegenerateEvent($this, 5))->call();
if($this->queryHandler !== null){
$this->queryHandler->regenerateInfo();
}
($this->queryRegenerateTask = new QueryRegenerateEvent($this))->call();
}
if($this->autoSave and ++$this->autoSaveTicker >= $this->autoSaveTicks){