run method

Future<void> run(
  1. GisilaQueue app
)

Builds a Worker for app from the parsed flags, starts it, prints a startup banner, and blocks until a SIGINT/SIGTERM triggers a graceful Worker.stop. Also closes app's broker/backend/control channel connections before returning, so the process actually exits instead of hanging on an open Redis socket.

Implementation

Future<void> run(GisilaQueue app) async {
  final worker = app.worker(queues: queues, concurrency: concurrency);
  installShutdownHooks(() async {
    stdout.writeln('\nworker ${worker.id} shutting down…');
    await worker.stop();
  });
  stdout.writeln('worker ${worker.id} → queues=${queues.join(',')} '
      'concurrency=$concurrency (redis $redisHost:$redisPort, prefix "$prefix")');
  await worker.run();
  await app.close();
}