busy('storage_publication_tick'); try { $worked = $worker->tick(); $errors = $worker->observationErrors(); } catch (\Throwable $error) { $errors[] = 'storage_publication_failed'; $heartbeat->error('storage_publication_failed'); fwrite( STDERR, 'storage publication worker temporarily unavailable: ' . get_class($error) . PHP_EOL ); if ($once) { return 1; } $worked = false; } if ($errors === []) { // An idle poll proves only that the process is alive. A // real successful finalization is required to clear an // earlier warning from this worker instance. if ($worked) { $unresolved = false; $heartbeat->success(); } elseif (!$unresolved) { $heartbeat->success(); } } else { $unresolved = true; $heartbeat->error('storage_publication_failed'); } if (!$once && !$worked) { usleep(1000000); } } while (!$once); } catch (\Throwable $error) { $heartbeat->error('storage_publication_failed'); throw $error; } finally { $heartbeat->stopped(); } return 0; } }