Work in progress: most of the infrastructure for running import via BG queues or CLI script is now in place (untested, no UI, needs tweaks & fixes)

This commit is contained in:
Brion Vibber
2010-09-23 16:40:22 -07:00
parent e8ad436a99
commit ae507b0485
4 changed files with 186 additions and 35 deletions

View File

@@ -36,11 +36,23 @@ class YammerQueueHandler extends QueueHandler
function handle($notice)
{
$importer = new YammerImporter();
if ($importer->hasWork()) {
return $importer->iterate();
$runner = YammerRunner::init();
if ($runner->hasWork()) {
if ($runner->iterate()) {
if ($runner->hasWork()) {
// More to do? Shove us back on the queue...
$qm = QueueManager::get();
$qm->enqueue('YammerImport', 'yammer');
}
return true;
} else {
// Something failed?
// @fixme should we be trying again here, or should we give warning?
return false;
}
} else {
// We're done!
common_log(LOG_INFO, "Yammer import has no work to do at this time; discarding.");
return true;
}
}