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 9c76fb7d96
commit a753c1342d
3 changed files with 26 additions and 47 deletions

View File

@ -1263,7 +1263,7 @@ class Server{
register_shutdown_function([$this, "crashDump"]);
$this->queryRegenerateTask = new QueryRegenerateEvent($this, 5);
$this->queryRegenerateTask = new QueryRegenerateEvent($this);
$this->pluginManager->loadPlugins($this->pluginPath);
@ -2008,10 +2008,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->sendUsageTicker > 0 and --$this->sendUsageTicker === 0){