forked from GNUsocial/gnu-social
Allow for instances as well as class names to be passed as queue handlers and iomanagers.
Introduce IoManager::GLOBAL_SINGLE_ONLY which indicates that only one instance of this iomanager will be run, regardless of how many threads/processes and sites there are.
This commit is contained in:
@@ -122,7 +122,7 @@ class QueueDaemon extends Daemon
|
||||
if ($this->threads > 1) {
|
||||
return $this->runThreads();
|
||||
} else {
|
||||
return $this->runLoop();
|
||||
return $this->runLoop(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,8 @@ class QueueDaemon extends Daemon
|
||||
{
|
||||
$this->set_id($this->get_id() . "." . $thread);
|
||||
$this->resetDb();
|
||||
$this->runLoop();
|
||||
//only include global singletons on the first thread
|
||||
$this->runLoop($thread == 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,14 +214,18 @@ class QueueDaemon extends Daemon
|
||||
*
|
||||
* Most of the time this won't need to be overridden in a subclass.
|
||||
*
|
||||
* @param boolean $includeGlobalSingletons Include IoManagers that are
|
||||
* global singletons (should only be one instance - regardless of how
|
||||
* many processes or sites there are)
|
||||
*
|
||||
* @return boolean true on success, false on failure
|
||||
*/
|
||||
function runLoop()
|
||||
function runLoop($includeGlobalSingletons)
|
||||
{
|
||||
$this->log(LOG_INFO, 'checking for queued notices');
|
||||
|
||||
$master = new IoMaster($this->get_id());
|
||||
$master->init($this->all);
|
||||
$master->init($this->all, $includeGlobalSingletons);
|
||||
$master->service();
|
||||
|
||||
$this->log(LOG_INFO, 'finished servicing the queue');
|
||||
|
||||
Reference in New Issue
Block a user