stop method
Stop the worker (for background workers)
Implementation
Future<void> stop({bool graceful = true}) async {
if (graceful) {
await _gracefulShutdown();
await _shutdownCompleter.future;
} else {
_shouldStop = true;
_workerTimer?.cancel();
_shutdownCompleter.complete();
}
}