remove sleep; stop reactor when not running as a worker thread