forked from GNUsocial/gnu-social
Made YammerImport more robust against errors; can now pause/resume/reset the import state from the admin interface.
This commit is contained in:
@@ -38,21 +38,24 @@ class YammerQueueHandler extends QueueHandler
|
||||
{
|
||||
$runner = YammerRunner::init();
|
||||
if ($runner->hasWork()) {
|
||||
if ($runner->iterate()) {
|
||||
if ($runner->hasWork()) {
|
||||
// More to do? Shove us back on the queue...
|
||||
$runner->startBackgroundImport();
|
||||
try {
|
||||
if ($runner->iterate()) {
|
||||
if ($runner->hasWork()) {
|
||||
// More to do? Shove us back on the queue...
|
||||
$runner->startBackgroundImport();
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
try {
|
||||
$runner->recordError($e->getMessage());
|
||||
} catch (Exception $f) {
|
||||
common_log(LOG_ERR, "Error while recording error in Yammer background import: " . $e->getMessage() . " " . $f->getMessage());
|
||||
}
|
||||
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;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user