run method

Future<void> run(
  1. Beat beat
)

Starts beat, prints a startup banner, and blocks until a SIGINT/SIGTERM triggers a graceful Beat.stop. Also closes beat's app connections before returning, so the process actually exits instead of hanging on an open Redis socket (Beat.stop already closes the lock/state-store connections it owns).

Implementation

Future<void> run(Beat beat) async {
  installShutdownHooks(() async {
    stdout.writeln('\nbeat ${beat.id} shutting down…');
    await beat.stop();
  });
  stdout.writeln('beat ${beat.id} → tick=${tickInterval.inSeconds}s '
      '(redis $redisHost:$redisPort, prefix "$prefix")');
  await beat.run();
  await beat.app.close();
}