boot method

  1. @override
Future<void> boot(
  1. ContainerInterface container
)
override

Initializes the QueueManager by calling its init method.

Implementation

@override

/// Initializes the [QueueManager] by calling its [init] method.
Future<void> boot(ContainerInterface container) async {
  final queue = container.resolve<QueueManager>();
  final config = container.resolve<ConfigInterface>();
  queue.loadFromConfig();
  container
      .resolve<Logger>()
      .info('✅ Queue system initialized (${queue.defaultDriverName})');
  if (config.get<bool?>('queue.auto_start') ?? false) {
    queue.startWorker(
      maxJobs: config.get<int?>('queue.max_jobs'),
      delay: Duration(seconds: config.get<int?>('queue.delay') ?? 1),
      timeout: config.get<int?>('queue.timeout') == null
          ? null
          : Duration(seconds: config.get<int?>('queue.timeout')!),
      runInBackground: config.get<bool?>('queue.run_in_background') ?? false,
      onError: (error, stack) {
        container.resolve<Logger>().error(error, stackTrace: stack);
      },
    );
  }
}