Utiliser le script de delayed_job
Problème rencontré
En production, on utilise généralement le script web-api/bin/delayed_job
qui propose plus d'options que les tâches rake
, à savoir start
, stop
, resatart
, status
. Or actuellement c'est la tâche bundle exec rake jobs:work
qui est utilisée pour le développement.
L'objectif de ce ticket est donc de se rapprocher, en environnement de développement, de l'environnement de production.
Comment reproduire ?
- Considérant l'application Filaé
- Lorsque je remplace l' entrypoint de jobs par
./bin/delayed_job start
- Alors jobs ne démarre pas correctement
- Et j'ai le message d'erreur docker
filae_src_jobs_1 exited with code 0
- Avec le trace suivante :
jobs_1 | pid-file for killed process 70 found (/app/web-api/tmp/pids/delayed_job.pid), deleting.
jobs_1 | E, [2022-12-16T14:18:44.683000 #67] ERROR -- : Exception rescued in listen-run_thread:
jobs_1 | IOError: closed stream
jobs_1 | /usr/local/bundle/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb:317:in `select'
jobs_1 | /usr/local/bundle/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb:317:in `readpartial'
jobs_1 | /usr/local/bundle/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb:290:in `read_events'
jobs_1 | /usr/local/bundle/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb:263:in `process'
jobs_1 | /usr/local/bundle/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb:236:in `block in run'
jobs_1 | /usr/local/bundle/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb:232:in `synchronize'
jobs_1 | /usr/local/bundle/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb:232:in `run'
jobs_1 | /usr/local/bundle/gems/listen-3.3.3/lib/listen/adapter/linux.rb:41:in `_run'
jobs_1 | /usr/local/bundle/gems/listen-3.3.3/lib/listen/adapter/base.rb:79:in `block in start'
jobs_1 | /usr/local/bundle/gems/listen-3.3.3/lib/listen/thread.rb:26:in `rescue_and_log'
jobs_1 | /usr/local/bundle/gems/listen-3.3.3/lib/listen/thread.rb:18:in `block in new'
jobs_1 | --- Thread.new ---
jobs_1 | /usr/local/bundle/gems/listen-3.3.3/lib/listen/adapter/base.rb:75:in `start'
jobs_1 | /usr/local/lib/ruby/3.1.0/forwardable.rb:238:in `start'
jobs_1 | /usr/local/bundle/gems/listen-3.3.3/lib/listen/listener.rb:71:in `block in <class:Listener>'
jobs_1 | /usr/local/bundle/gems/listen-3.3.3/lib/listen/fsm.rb:121:in `instance_eval'
jobs_1 | /usr/local/bundle/gems/listen-3.3.3/lib/listen/fsm.rb:121:in `call'
jobs_1 | /usr/local/bundle/gems/listen-3.3.3/lib/listen/fsm.rb:102:in `transition_with_callbacks!'
jobs_1 | /usr/local/bundle/gems/listen-3.3.3/lib/listen/fsm.rb:69:in `transition'
jobs_1 | /usr/local/bundle/gems/listen-3.3.3/lib/listen/listener.rb:92:in `start'
jobs_1 | /usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/evented_file_update_checker.rb:109:in `start'
jobs_1 | /usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/evented_file_update_checker.rb:89:in `block in initialize'
jobs_1 | /usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:38:in `each'
jobs_1 | /usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:38:in `check!'
jobs_1 | /usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:14:in `fork'
jobs_1 | /usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:27:in `fork'
jobs_1 | /usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:13:in `fork'
jobs_1 | /usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:27:in `fork'
jobs_1 | /usr/local/bundle/gems/daemons-1.3.1/lib/daemons/daemonize.rb:10:in `safefork'
jobs_1 | /usr/local/bundle/gems/daemons-1.3.1/lib/daemons/daemonize.rb:67:in `call_as_daemon'
jobs_1 | /usr/local/bundle/gems/daemons-1.3.1/lib/daemons/application.rb:279:in `start_proc'
jobs_1 | /usr/local/bundle/gems/daemons-1.3.1/lib/daemons/application.rb:305:in `start'
jobs_1 | /usr/local/bundle/gems/daemons-1.3.1/lib/daemons/controller.rb:56:in `run'
jobs_1 | /usr/local/bundle/gems/daemons-1.3.1/lib/daemons.rb:199:in `block in run_proc'
jobs_1 | /usr/local/bundle/gems/daemons-1.3.1/lib/daemons/cmdline.rb:121:in `catch_exceptions'
jobs_1 | /usr/local/bundle/gems/daemons-1.3.1/lib/daemons.rb:198:in `run_proc'
jobs_1 | /usr/local/bundle/gems/delayed_job-4.1.10/lib/delayed/command.rb:123:in `run_process'
jobs_1 | /usr/local/bundle/gems/delayed_job-4.1.10/lib/delayed/command.rb:104:in `block in daemonize'
jobs_1 | /usr/local/bundle/gems/delayed_job-4.1.10/lib/delayed/command.rb:102:in `times'
jobs_1 | /usr/local/bundle/gems/delayed_job-4.1.10/lib/delayed/command.rb:102:in `daemonize'
jobs_1 | /app/web-api/bin/delayed_job:5:in `<main>'
jobs_1 | delayed_job: process with pid 67 started.
Comportement attendu
- Considérant l'application Filaé
- Lorsque je remplace l' entrypoint de jobs par
./bin/delayed_job start
- Alors jobs démarre correctement
- Et tous les tests sont verts
💚