wurk 1.15.1 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +16 -6
- data/app/controllers/wurk/api_controller.rb +4 -1
- data/app/controllers/wurk/profiles_controller.rb +15 -2
- data/lib/wurk/api/app.rb +20 -0
- data/lib/wurk/api/problem.rb +8 -1
- data/lib/wurk/batch/callbacks.rb +96 -12
- data/lib/wurk/batch/death_handler.rb +3 -1
- data/lib/wurk/batch/server_middleware.rb +7 -3
- data/lib/wurk/capsule.rb +14 -0
- data/lib/wurk/client/buffered.rb +124 -25
- data/lib/wurk/client.rb +20 -0
- data/lib/wurk/configuration.rb +9 -2
- data/lib/wurk/cron.rb +35 -4
- data/lib/wurk/fetcher/unit_of_work.rb +7 -0
- data/lib/wurk/health.rb +4 -1
- data/lib/wurk/iterable_job.rb +35 -9
- data/lib/wurk/job_retry.rb +10 -2
- data/lib/wurk/job_set.rb +9 -4
- data/lib/wurk/logger.rb +7 -0
- data/lib/wurk/lua/limiter_points_refund.lua +3 -1
- data/lib/wurk/lua.rb +54 -7
- data/lib/wurk/middleware/current_attributes.rb +40 -11
- data/lib/wurk/processor.rb +46 -2
- data/lib/wurk/queues.rb +84 -17
- data/lib/wurk/rails_boot.rb +1 -1
- data/lib/wurk/sorted_entry.rb +10 -2
- data/lib/wurk/stats.rb +26 -3
- data/lib/wurk/swarm/child_boot.rb +6 -1
- data/lib/wurk/unique.rb +32 -6
- data/lib/wurk/version.rb +1 -1
- data/lib/wurk/worker/setter.rb +13 -15
- data/lib/wurk/worker.rb +3 -18
- data/lib/wurk.rb +5 -1
- data/vendor/assets/dashboard/assets/ArgsValue-s6SvnYnn.js +1 -0
- data/vendor/assets/dashboard/assets/ArgsValue-s6SvnYnn.js.br +0 -0
- data/vendor/assets/dashboard/assets/ArgsValue-s6SvnYnn.js.gz +0 -0
- data/vendor/assets/dashboard/assets/BatchDetail-CprIJHVF.js +1 -0
- data/vendor/assets/dashboard/assets/BatchDetail-CprIJHVF.js.br +0 -0
- data/vendor/assets/dashboard/assets/BatchDetail-CprIJHVF.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Batches-_UtmkdcL.js +1 -0
- data/vendor/assets/dashboard/assets/Batches-_UtmkdcL.js.br +0 -0
- data/vendor/assets/dashboard/assets/Batches-_UtmkdcL.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Busy-CxUt_KaT.js +1 -0
- data/vendor/assets/dashboard/assets/Busy-CxUt_KaT.js.br +0 -0
- data/vendor/assets/dashboard/assets/Busy-CxUt_KaT.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Cron-BO4CLzcL.js +1 -0
- data/vendor/assets/dashboard/assets/Cron-BO4CLzcL.js.br +0 -0
- data/vendor/assets/dashboard/assets/Cron-BO4CLzcL.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Dashboard-BpeXrgWN.js +1 -0
- data/vendor/assets/dashboard/assets/Dashboard-BpeXrgWN.js.br +0 -0
- data/vendor/assets/dashboard/assets/Dashboard-BpeXrgWN.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Dead-DxG8m9Ea.js +1 -0
- data/vendor/assets/dashboard/assets/Dead-DxG8m9Ea.js.br +0 -0
- data/vendor/assets/dashboard/assets/Dead-DxG8m9Ea.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Extension-Bdw1AWK9.js +1 -0
- data/vendor/assets/dashboard/assets/Extension-Bdw1AWK9.js.br +0 -0
- data/vendor/assets/dashboard/assets/Extension-Bdw1AWK9.js.gz +0 -0
- data/vendor/assets/dashboard/assets/FilterBox-qrHAQiEp.js +1 -0
- data/vendor/assets/dashboard/assets/FilterBox-qrHAQiEp.js.br +0 -0
- data/vendor/assets/dashboard/assets/FilterBox-qrHAQiEp.js.gz +0 -0
- data/vendor/assets/dashboard/assets/FlowDetail-BbLiOUVq.js +1 -0
- data/vendor/assets/dashboard/assets/FlowDetail-BbLiOUVq.js.br +0 -0
- data/vendor/assets/dashboard/assets/FlowDetail-BbLiOUVq.js.gz +0 -0
- data/vendor/assets/dashboard/assets/{FlowState-B04ZLDe-.js → FlowState-Cp2exrrY.js} +1 -1
- data/vendor/assets/dashboard/assets/FlowState-Cp2exrrY.js.br +2 -0
- data/vendor/assets/dashboard/assets/FlowState-Cp2exrrY.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Flows-Cdh5HxbD.js +1 -0
- data/vendor/assets/dashboard/assets/Flows-Cdh5HxbD.js.br +0 -0
- data/vendor/assets/dashboard/assets/Flows-Cdh5HxbD.js.gz +0 -0
- data/vendor/assets/dashboard/assets/JobDetailModal-DyrUaaGZ.js +2 -0
- data/vendor/assets/dashboard/assets/JobDetailModal-DyrUaaGZ.js.br +0 -0
- data/vendor/assets/dashboard/assets/JobDetailModal-DyrUaaGZ.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Limiters-D7r6cfSD.js +1 -0
- data/vendor/assets/dashboard/assets/Limiters-D7r6cfSD.js.br +0 -0
- data/vendor/assets/dashboard/assets/Limiters-D7r6cfSD.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Metrics-BLenaRy4.js +1 -0
- data/vendor/assets/dashboard/assets/Metrics-BLenaRy4.js.br +0 -0
- data/vendor/assets/dashboard/assets/Metrics-BLenaRy4.js.gz +0 -0
- data/vendor/assets/dashboard/assets/NotFound-P0HnKG_i.js +1 -0
- data/vendor/assets/dashboard/assets/NotFound-P0HnKG_i.js.br +0 -0
- data/vendor/assets/dashboard/assets/NotFound-P0HnKG_i.js.gz +0 -0
- data/vendor/assets/dashboard/assets/PageHeader-Dr0x5uFD.js +1 -0
- data/vendor/assets/dashboard/assets/PageHeader-Dr0x5uFD.js.br +0 -0
- data/vendor/assets/dashboard/assets/PageHeader-Dr0x5uFD.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Profiles-DwBcuGsp.js +1 -0
- data/vendor/assets/dashboard/assets/Profiles-DwBcuGsp.js.br +0 -0
- data/vendor/assets/dashboard/assets/Profiles-DwBcuGsp.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Queues-BpB_QfMT.js +1 -0
- data/vendor/assets/dashboard/assets/Queues-BpB_QfMT.js.br +0 -0
- data/vendor/assets/dashboard/assets/Queues-BpB_QfMT.js.gz +0 -0
- data/vendor/assets/dashboard/assets/RefreshError-CFF9cD72.js +1 -0
- data/vendor/assets/dashboard/assets/RefreshError-CFF9cD72.js.br +0 -0
- data/vendor/assets/dashboard/assets/RefreshError-CFF9cD72.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Retries-CvpBa3nA.js +1 -0
- data/vendor/assets/dashboard/assets/Retries-CvpBa3nA.js.br +0 -0
- data/vendor/assets/dashboard/assets/Retries-CvpBa3nA.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Scheduled-B5_rNwmD.js +1 -0
- data/vendor/assets/dashboard/assets/Scheduled-B5_rNwmD.js.br +0 -0
- data/vendor/assets/dashboard/assets/Scheduled-B5_rNwmD.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Search-DBiXXQ1X.js +1 -0
- data/vendor/assets/dashboard/assets/Search-DBiXXQ1X.js.br +0 -0
- data/vendor/assets/dashboard/assets/Search-DBiXXQ1X.js.gz +0 -0
- data/vendor/assets/dashboard/assets/activatable-CjwuwYIK.js +1 -0
- data/vendor/assets/dashboard/assets/activatable-CjwuwYIK.js.br +0 -0
- data/vendor/assets/dashboard/assets/activatable-CjwuwYIK.js.gz +0 -0
- data/vendor/assets/dashboard/assets/{ar-CugpXGea.js → ar-CP7xhN_d.js} +1 -1
- data/vendor/assets/dashboard/assets/ar-CP7xhN_d.js.br +0 -0
- data/vendor/assets/dashboard/assets/ar-CP7xhN_d.js.gz +0 -0
- data/vendor/assets/dashboard/assets/charts-BowrQgy3.js +1 -0
- data/vendor/assets/dashboard/assets/charts-BowrQgy3.js.br +0 -0
- data/vendor/assets/dashboard/assets/charts-BowrQgy3.js.gz +0 -0
- data/vendor/assets/dashboard/assets/de-CESa1rIa.js +1 -0
- data/vendor/assets/dashboard/assets/de-CESa1rIa.js.br +0 -0
- data/vendor/assets/dashboard/assets/de-CESa1rIa.js.gz +0 -0
- data/vendor/assets/dashboard/assets/es-DduN2Y-4.js +1 -0
- data/vendor/assets/dashboard/assets/es-DduN2Y-4.js.br +0 -0
- data/vendor/assets/dashboard/assets/es-DduN2Y-4.js.gz +0 -0
- data/vendor/assets/dashboard/assets/fr-D0g3vgjI.js +1 -0
- data/vendor/assets/dashboard/assets/fr-D0g3vgjI.js.br +0 -0
- data/vendor/assets/dashboard/assets/fr-D0g3vgjI.js.gz +0 -0
- data/vendor/assets/dashboard/assets/i18n-DyFKCgd5.js +1 -0
- data/vendor/assets/dashboard/assets/i18n-DyFKCgd5.js.br +0 -0
- data/vendor/assets/dashboard/assets/i18n-DyFKCgd5.js.gz +0 -0
- data/vendor/assets/dashboard/assets/index-BX9nblxT.css +1 -0
- data/vendor/assets/dashboard/assets/index-BX9nblxT.css.br +0 -0
- data/vendor/assets/dashboard/assets/index-BX9nblxT.css.gz +0 -0
- data/vendor/assets/dashboard/assets/index-lb7Hct36.js +141 -0
- data/vendor/assets/dashboard/assets/index-lb7Hct36.js.br +0 -0
- data/vendor/assets/dashboard/assets/index-lb7Hct36.js.gz +0 -0
- data/vendor/assets/dashboard/assets/ja-D04z9gNg.js +1 -0
- data/vendor/assets/dashboard/assets/ja-D04z9gNg.js.br +0 -0
- data/vendor/assets/dashboard/assets/ja-D04z9gNg.js.gz +0 -0
- data/vendor/assets/dashboard/assets/{pt-BR-4k5M2MYH.js → pt-BR-CI0f7zuq.js} +1 -1
- data/vendor/assets/dashboard/assets/pt-BR-CI0f7zuq.js.br +0 -0
- data/vendor/assets/dashboard/assets/pt-BR-CI0f7zuq.js.gz +0 -0
- data/vendor/assets/dashboard/assets/useJobSetList-DOJEPjtn.js +2 -0
- data/vendor/assets/dashboard/assets/useJobSetList-DOJEPjtn.js.br +0 -0
- data/vendor/assets/dashboard/assets/useJobSetList-DOJEPjtn.js.gz +0 -0
- data/vendor/assets/dashboard/assets/useResetPageOnEmpty-BkhAVjcM.js +1 -0
- data/vendor/assets/dashboard/assets/useResetPageOnEmpty-BkhAVjcM.js.br +0 -0
- data/vendor/assets/dashboard/assets/useResetPageOnEmpty-BkhAVjcM.js.gz +0 -0
- data/vendor/assets/dashboard/assets/useSort-BH4O54LC.js +1 -0
- data/vendor/assets/dashboard/assets/useSort-BH4O54LC.js.br +0 -0
- data/vendor/assets/dashboard/assets/useSort-BH4O54LC.js.gz +0 -0
- data/vendor/assets/dashboard/assets/{utils-Az0d2-xz.js → utils-5e3YBxoh.js} +1 -1
- data/vendor/assets/dashboard/assets/utils-5e3YBxoh.js.br +0 -0
- data/vendor/assets/dashboard/assets/utils-5e3YBxoh.js.gz +0 -0
- data/vendor/assets/dashboard/assets/zh-CN-Ty7GVN_E.js +1 -0
- data/vendor/assets/dashboard/assets/zh-CN-Ty7GVN_E.js.br +0 -0
- data/vendor/assets/dashboard/assets/zh-CN-Ty7GVN_E.js.gz +0 -0
- data/vendor/assets/dashboard/index.html +3 -3
- data/vendor/assets/dashboard/wurk-manifest.json +2 -2
- metadata +118 -112
- data/vendor/assets/dashboard/assets/ArgsValue-DSNRXbbF.js +0 -1
- data/vendor/assets/dashboard/assets/ArgsValue-DSNRXbbF.js.br +0 -0
- data/vendor/assets/dashboard/assets/ArgsValue-DSNRXbbF.js.gz +0 -0
- data/vendor/assets/dashboard/assets/BatchDetail-DbddHvay.js +0 -1
- data/vendor/assets/dashboard/assets/BatchDetail-DbddHvay.js.br +0 -0
- data/vendor/assets/dashboard/assets/BatchDetail-DbddHvay.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Batches-D-qS6l6A.js +0 -1
- data/vendor/assets/dashboard/assets/Batches-D-qS6l6A.js.br +0 -0
- data/vendor/assets/dashboard/assets/Batches-D-qS6l6A.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Busy-BYEpKo6H.js +0 -1
- data/vendor/assets/dashboard/assets/Busy-BYEpKo6H.js.br +0 -0
- data/vendor/assets/dashboard/assets/Busy-BYEpKo6H.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Cron-BOTMv9J0.js +0 -1
- data/vendor/assets/dashboard/assets/Cron-BOTMv9J0.js.br +0 -0
- data/vendor/assets/dashboard/assets/Cron-BOTMv9J0.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Dashboard-BmdMHA0S.js +0 -1
- data/vendor/assets/dashboard/assets/Dashboard-BmdMHA0S.js.br +0 -0
- data/vendor/assets/dashboard/assets/Dashboard-BmdMHA0S.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Dead-CmoKRD2C.js +0 -1
- data/vendor/assets/dashboard/assets/Dead-CmoKRD2C.js.br +0 -0
- data/vendor/assets/dashboard/assets/Dead-CmoKRD2C.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Extension-BhP5isgr.js +0 -1
- data/vendor/assets/dashboard/assets/Extension-BhP5isgr.js.br +0 -0
- data/vendor/assets/dashboard/assets/Extension-BhP5isgr.js.gz +0 -0
- data/vendor/assets/dashboard/assets/FilterBox-DBIZXNtY.js +0 -1
- data/vendor/assets/dashboard/assets/FilterBox-DBIZXNtY.js.br +0 -0
- data/vendor/assets/dashboard/assets/FilterBox-DBIZXNtY.js.gz +0 -0
- data/vendor/assets/dashboard/assets/FlowDetail-CN97QgjE.js +0 -1
- data/vendor/assets/dashboard/assets/FlowDetail-CN97QgjE.js.br +0 -0
- data/vendor/assets/dashboard/assets/FlowDetail-CN97QgjE.js.gz +0 -0
- data/vendor/assets/dashboard/assets/FlowState-B04ZLDe-.js.br +0 -0
- data/vendor/assets/dashboard/assets/FlowState-B04ZLDe-.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Flows-CJaBWl24.js +0 -1
- data/vendor/assets/dashboard/assets/Flows-CJaBWl24.js.br +0 -0
- data/vendor/assets/dashboard/assets/Flows-CJaBWl24.js.gz +0 -0
- data/vendor/assets/dashboard/assets/JobDetailModal-BKxX4Wpk.js +0 -2
- data/vendor/assets/dashboard/assets/JobDetailModal-BKxX4Wpk.js.br +0 -0
- data/vendor/assets/dashboard/assets/JobDetailModal-BKxX4Wpk.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Limiters-RqxwfODD.js +0 -1
- data/vendor/assets/dashboard/assets/Limiters-RqxwfODD.js.br +0 -0
- data/vendor/assets/dashboard/assets/Limiters-RqxwfODD.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Metrics-Qyfu0K6J.js +0 -1
- data/vendor/assets/dashboard/assets/Metrics-Qyfu0K6J.js.br +0 -0
- data/vendor/assets/dashboard/assets/Metrics-Qyfu0K6J.js.gz +0 -0
- data/vendor/assets/dashboard/assets/NotFound-CQozbLGO.js +0 -1
- data/vendor/assets/dashboard/assets/NotFound-CQozbLGO.js.br +0 -0
- data/vendor/assets/dashboard/assets/NotFound-CQozbLGO.js.gz +0 -0
- data/vendor/assets/dashboard/assets/PageHeader-BDXaICrU.js +0 -1
- data/vendor/assets/dashboard/assets/PageHeader-BDXaICrU.js.br +0 -0
- data/vendor/assets/dashboard/assets/PageHeader-BDXaICrU.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Profiles-DpMDGxoE.js +0 -1
- data/vendor/assets/dashboard/assets/Profiles-DpMDGxoE.js.br +0 -0
- data/vendor/assets/dashboard/assets/Profiles-DpMDGxoE.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Queues-B2RVkHLs.js +0 -1
- data/vendor/assets/dashboard/assets/Queues-B2RVkHLs.js.br +0 -0
- data/vendor/assets/dashboard/assets/Queues-B2RVkHLs.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Retries-C2sAd4Gk.js +0 -1
- data/vendor/assets/dashboard/assets/Retries-C2sAd4Gk.js.br +0 -0
- data/vendor/assets/dashboard/assets/Retries-C2sAd4Gk.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Scheduled-CKPcR-0t.js +0 -1
- data/vendor/assets/dashboard/assets/Scheduled-CKPcR-0t.js.br +0 -0
- data/vendor/assets/dashboard/assets/Scheduled-CKPcR-0t.js.gz +0 -0
- data/vendor/assets/dashboard/assets/Search-KvJ7HjUn.js +0 -1
- data/vendor/assets/dashboard/assets/Search-KvJ7HjUn.js.br +0 -0
- data/vendor/assets/dashboard/assets/Search-KvJ7HjUn.js.gz +0 -0
- data/vendor/assets/dashboard/assets/ar-CugpXGea.js.br +0 -0
- data/vendor/assets/dashboard/assets/ar-CugpXGea.js.gz +0 -0
- data/vendor/assets/dashboard/assets/charts-CSwj2Y-E.js +0 -1
- data/vendor/assets/dashboard/assets/charts-CSwj2Y-E.js.br +0 -0
- data/vendor/assets/dashboard/assets/charts-CSwj2Y-E.js.gz +0 -0
- data/vendor/assets/dashboard/assets/de-Bl5Jn_0l.js +0 -1
- data/vendor/assets/dashboard/assets/de-Bl5Jn_0l.js.br +0 -0
- data/vendor/assets/dashboard/assets/de-Bl5Jn_0l.js.gz +0 -0
- data/vendor/assets/dashboard/assets/es-lqQrmjYI.js +0 -1
- data/vendor/assets/dashboard/assets/es-lqQrmjYI.js.br +0 -0
- data/vendor/assets/dashboard/assets/es-lqQrmjYI.js.gz +0 -0
- data/vendor/assets/dashboard/assets/fr-D70VBoh3.js +0 -1
- data/vendor/assets/dashboard/assets/fr-D70VBoh3.js.br +0 -0
- data/vendor/assets/dashboard/assets/fr-D70VBoh3.js.gz +0 -0
- data/vendor/assets/dashboard/assets/i18n-DdPClaCG.js +0 -1
- data/vendor/assets/dashboard/assets/i18n-DdPClaCG.js.br +0 -0
- data/vendor/assets/dashboard/assets/i18n-DdPClaCG.js.gz +0 -0
- data/vendor/assets/dashboard/assets/index-DdMJr-ZQ.js +0 -141
- data/vendor/assets/dashboard/assets/index-DdMJr-ZQ.js.br +0 -0
- data/vendor/assets/dashboard/assets/index-DdMJr-ZQ.js.gz +0 -0
- data/vendor/assets/dashboard/assets/index-U83KcqT1.css +0 -1
- data/vendor/assets/dashboard/assets/index-U83KcqT1.css.br +0 -0
- data/vendor/assets/dashboard/assets/index-U83KcqT1.css.gz +0 -0
- data/vendor/assets/dashboard/assets/ja-BYMqnHjg.js +0 -1
- data/vendor/assets/dashboard/assets/ja-BYMqnHjg.js.br +0 -0
- data/vendor/assets/dashboard/assets/ja-BYMqnHjg.js.gz +0 -0
- data/vendor/assets/dashboard/assets/pt-BR-4k5M2MYH.js.br +0 -0
- data/vendor/assets/dashboard/assets/pt-BR-4k5M2MYH.js.gz +0 -0
- data/vendor/assets/dashboard/assets/useJobSetList-BDkKIAvU.js +0 -2
- data/vendor/assets/dashboard/assets/useJobSetList-BDkKIAvU.js.br +0 -0
- data/vendor/assets/dashboard/assets/useJobSetList-BDkKIAvU.js.gz +0 -0
- data/vendor/assets/dashboard/assets/useResetPageOnEmpty-DHrPaV9z.js +0 -1
- data/vendor/assets/dashboard/assets/useResetPageOnEmpty-DHrPaV9z.js.br +0 -0
- data/vendor/assets/dashboard/assets/useResetPageOnEmpty-DHrPaV9z.js.gz +0 -0
- data/vendor/assets/dashboard/assets/useSort-5-b2NAdA.js +0 -1
- data/vendor/assets/dashboard/assets/useSort-5-b2NAdA.js.br +0 -0
- data/vendor/assets/dashboard/assets/useSort-5-b2NAdA.js.gz +0 -0
- data/vendor/assets/dashboard/assets/utils-Az0d2-xz.js.br +0 -0
- data/vendor/assets/dashboard/assets/utils-Az0d2-xz.js.gz +0 -0
- data/vendor/assets/dashboard/assets/zh-CN-B9E1MvsM.js +0 -1
- data/vendor/assets/dashboard/assets/zh-CN-B9E1MvsM.js.br +0 -0
- data/vendor/assets/dashboard/assets/zh-CN-B9E1MvsM.js.gz +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1c7c838606efb1654b5f8e8d2d95e96db331a753506dea9a2da1ee305510b665
|
|
4
|
+
data.tar.gz: 6ca92b8494c6c26af334527cb0ab2f5f61e993d57b1c79628f11bf86781baf1e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fa5e8e9a520ae5408642f32078e84b56c2a1e04f3204ab7494a4527c5e847671995203a06feff1e8c6b395bd6f8be07f9b890a8e8f630330de91f8f2942ce9fb
|
|
7
|
+
data.tar.gz: 832245bf136243e53fe5e487daebf6c73476506038b3964787892f230379068a08aa6674c95f7ccb02062f975e7059e5b32d0710f0a12d36667c1d4c8903e80c
|
data/README.md
CHANGED
|
@@ -105,8 +105,8 @@ Sidekiq has no equivalent for any of these — they aren't parity, they're new s
|
|
|
105
105
|
| **[Debounce, throttle-to-slot & collapse](docs/unique-jobs.md)** | `collapse: { policy: :debounce }` coalesces bursts into one job (last payload wins); `collapse: { policy: :throttle }` admits one job per fixed time slot | Burst coalescing — every enqueue in the window runs standalone again |
|
|
106
106
|
| **[Per-job timeouts & deadlines](docs/retries.md)** | `timeout:` bounds one attempt, `deadline:` bounds the whole job from enqueue, enforced by a lightweight per-capsule watchdog thread (no thread-per-job) | Runaway/stuck jobs run unbounded except for `shutdown_timeout` |
|
|
107
107
|
| **[Global per-queue concurrency caps](docs/rate-limiting.md)** | `config.global_concurrency = { critical: 20 }` caps in-flight jobs for a queue across the whole cluster, folded into the fetch pipeline | The cluster-wide cap; only per-key `Limiter`s remain |
|
|
108
|
-
| **Worker topology DSL** |
|
|
109
|
-
| **[Kubernetes probes](#kubernetes-metrics--tracing)** | `config.health_check` opens a thin `/live`/`/ready` HTTP listener, self-electing across a swarm's children | The built-in probe listener; roll your own liveness check |
|
|
108
|
+
| **Worker topology DSL** | `config.topology` declares how many processes of each kind the swarm forks, with each kind's queues and concurrency, in code instead of ad hoc `-q` flags | The declarative topology; fall back to CLI queue flags |
|
|
109
|
+
| **[Kubernetes probes](#kubernetes-metrics--tracing)** | `config.health_check` opens a thin `/live`/`/ready`/`/metrics` HTTP listener, self-electing across a swarm's children | The built-in probe listener; roll your own liveness check |
|
|
110
110
|
| **Dashboard theme, locale & timezone** | Light/dark/system theme, per-visitor locale override, and a 400-zone timezone picker for every timestamp in the SPA | Nothing server-side — this is dashboard-only |
|
|
111
111
|
|
|
112
112
|
AI dashboard panes — anomaly detection, natural-language queries, error triage, and capacity forecasting — are **planned, not shipped**: they're [roadmap M5](docs/idea/13-roadmap.md#m5--ai-dashboard), after the M4.5 extras above.
|
|
@@ -258,10 +258,11 @@ end
|
|
|
258
258
|
|
|
259
259
|
| Path | Meaning |
|
|
260
260
|
|---|---|
|
|
261
|
-
| `/live` | 200
|
|
261
|
+
| `/live` | 200 until the process is shutting down; 503 once `stop` is called. A quiet process stays 200, so quieting a pod does not get it restarted. |
|
|
262
|
+
| `/metrics` | Prometheus text exposition; `metrics: false` turns it into a 404. |
|
|
262
263
|
| `/ready` | 200 only when Redis is reachable **and** the heartbeat fired within `ready_window` (default 30s); 503 otherwise. |
|
|
263
264
|
|
|
264
|
-
Knobs: `health_check(port:, bind: "0.0.0.0", ready_window: 30)
|
|
265
|
+
Knobs: `health_check(port:, bind: "0.0.0.0", ready_window: 30, metrics: true, min_ready: nil)`, or `WURK_HEALTH_PORT` to turn it on from the environment. In swarm mode one child owns the port; the others poll every 5s and take it over if the owner dies, so probes survive a child restart — a pod never fails a probe just because a worker recycled.
|
|
265
266
|
|
|
266
267
|
**Getting the numbers out.** Point these at whatever you already run:
|
|
267
268
|
|
|
@@ -273,7 +274,7 @@ Knobs: `health_check(port:, bind: "0.0.0.0", ready_window: 30)`. In swarm mode o
|
|
|
273
274
|
| Queue/job/swarm state for external scrapers and autoscalers | Bearer-token `/v1` JSON API, mountable standalone or via `wurk api` | [api-http](docs/api-http.md) |
|
|
274
275
|
| Errors | Built-in Sentry reporting, terminal failures only, no job args | [sentry](docs/sentry.md) |
|
|
275
276
|
|
|
276
|
-
|
|
277
|
+
For Prometheus, scrape `GET /metrics` on the probe port ([metrics](docs/metrics.md)); the StatsD export and the `/v1` API are the other paths into a Prometheus/Grafana stack.
|
|
277
278
|
|
|
278
279
|
**Backpressure at fleet scale.** `config.global_concurrency = { critical: 20 }` caps in-flight jobs for a queue across every pod, folded into the fetch pipeline rather than bolted on as a middleware sleep — see [rate limiting](docs/rate-limiting.md).
|
|
279
280
|
|
|
@@ -305,7 +306,7 @@ Wurk is MIT and stays that way. If what you need is a commercial support contrac
|
|
|
305
306
|
|
|
306
307
|
`bundle install && restart`. The worker command stays as it was: Wurk ships `sidekiq` and `sidekiqswarm` executables, so `bundle exec sidekiq -C config/sidekiq.yml` in a Procfile or manifest keeps working. Wurk reads and writes the same Redis schema, so there is no data migration: Wurk picks up the queues, schedules, retries, batches and periodic loops Sidekiq left behind. Running Sidekiq and Wurk workers against one Redis *at the same time* is tested for stock Sidekiq 8 only, which may roll from one to the other under the conditions the guide lists; for a Sidekiq 7.x, Pro or Enterprise app a live production move is a **drain cutover** (stop Sidekiq's workers, confirm nothing is in flight, start Wurk), with a matching rollback. The [production cutover](https://github.com/developerz-ai/wurk/blob/main/docs/migrate-from-sidekiq.md#9-production-cutover) section has every step and command. The upstream suites of sidekiq-cron, sidekiq-unique-jobs, sidekiq-failures and sentry-sidekiq run against Wurk in the [`ecosystem` CI job](https://github.com/developerz-ai/wurk/blob/main/.github/workflows/ecosystem.yml) (see [`test/ecosystem/`](https://github.com/developerz-ai/wurk/tree/main/test/ecosystem)). sidekiq-scheduler, sidekiq-status and sidekiq-throttled are target additions tracked in [docs/idea/14-ecosystem-compat.md](https://github.com/developerz-ai/wurk/blob/main/docs/idea/14-ecosystem-compat.md).
|
|
307
308
|
|
|
308
|
-
**Keeping a `sidekiq-*` add-on gem?** Those gems declare `add_dependency "sidekiq"`, which would reinstall real Sidekiq next to Wurk. Satisfy it with Wurk's git-only [`sidekiq` shim gem](https://github.com/developerz-ai/wurk/tree/main/ecosystem/sidekiq-shim) instead, pinned to the tag of the Wurk release you run: `gem "sidekiq", github: "developerz-ai/wurk", tag: "v1.
|
|
309
|
+
**Keeping a `sidekiq-*` add-on gem?** Those gems declare `add_dependency "sidekiq"`, which would reinstall real Sidekiq next to Wurk. Satisfy it with Wurk's git-only [`sidekiq` shim gem](https://github.com/developerz-ai/wurk/tree/main/ecosystem/sidekiq-shim) instead, pinned to the tag of the Wurk release you run: `gem "sidekiq", github: "developerz-ai/wurk", tag: "v1.16.0", glob: "ecosystem/sidekiq-shim/*.gemspec"`. Only sidekiq-cron, sidekiq-unique-jobs, sidekiq-failures and sentry-sidekiq are exercised that way, by the `ecosystem` workflow; treat the others as untested.
|
|
309
310
|
|
|
310
311
|
Full walkthrough — config side-by-side, the Redis key/`sidekiq_options` mapping, known incompatibilities, moving sidekiq-cron schedules over (`rake wurk:import:cron`), and the production cutover and rollback playbook: **[docs/migrate-from-sidekiq.md](https://github.com/developerz-ai/wurk/blob/main/docs/migrate-from-sidekiq.md)**. On the night, keep the **[incident runbook](https://github.com/developerz-ai/wurk/blob/main/docs/runbook.md)** open.
|
|
311
312
|
|
|
@@ -336,6 +337,15 @@ TypeScript end to end, MIT, and as measured about its own claims as this file is
|
|
|
336
337
|
|
|
337
338
|
Releases follow the work, not a calendar. A weekday checkup asks whether a shipping fix has merged and nobody has released it. When one has, the bot files a release request, its coding fleet opens the `Wurk::VERSION` bump PR, and merging that PR publishes the gem ([RELEASE.md](RELEASE.md)). The bot's policy is committed in [`.dz/maintainer/maintainer.yml`](.dz/maintainer/maintainer.yml).
|
|
338
339
|
|
|
340
|
+
## Stargazers
|
|
341
|
+
|
|
342
|
+
<a href="https://star-history.com/#developerz-ai/wurk&Date">
|
|
343
|
+
<picture>
|
|
344
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=developerz-ai/wurk&type=Date&theme=dark">
|
|
345
|
+
<img alt="GitHub stars of developerz-ai/wurk over time" src="https://api.star-history.com/svg?repos=developerz-ai/wurk&type=Date" width="100%">
|
|
346
|
+
</picture>
|
|
347
|
+
</a>
|
|
348
|
+
|
|
339
349
|
## Contributing
|
|
340
350
|
|
|
341
351
|
Issues and pull requests are welcome — see **[CONTRIBUTING.md](https://github.com/developerz-ai/wurk/blob/main/CONTRIBUTING.md)** for the dev setup, test layers, and conventions, and **[SECURITY.md](https://github.com/developerz-ai/wurk/blob/main/SECURITY.md)** to report a vulnerability.
|
|
@@ -92,7 +92,10 @@ module Wurk
|
|
|
92
92
|
# Removes a single job from a queue by jid — one Lua round-trip
|
|
93
93
|
# (Fast::QueueExt#delete_job) instead of a paged find_job walk.
|
|
94
94
|
def delete_queue_job
|
|
95
|
-
|
|
95
|
+
jid = params[:jid].to_s
|
|
96
|
+
return render(json: { error: 'jid required' }, status: :bad_request) if jid.empty?
|
|
97
|
+
|
|
98
|
+
removed = ::Wurk::Queue.new(params[:name].to_s).delete_job(jid)
|
|
96
99
|
return render(json: { error: 'unknown job' }, status: :not_found) if removed.nil?
|
|
97
100
|
|
|
98
101
|
render json: { ok: true, deleted: true }
|
|
@@ -19,9 +19,18 @@ module Wurk
|
|
|
19
19
|
# other mutation, and read-only mode refuses it (#101 W5).
|
|
20
20
|
#
|
|
21
21
|
# `:key` is "<token>-<jid>". The JSON list lives at /api/profiles.
|
|
22
|
+
#
|
|
23
|
+
# `:key` is request input that is otherwise used verbatim as a Redis key, so
|
|
24
|
+
# every action first requires it to be a member of the `profiles` ZSET
|
|
25
|
+
# (where both Wurk and Sidekiq register each stored profile). Without that,
|
|
26
|
+
# a non-HASH key WRONGTYPEs into a false "redis_unavailable" 503, and any
|
|
27
|
+
# HASH with a `data` field could be shipped to the profiler and have a `sid`
|
|
28
|
+
# written into it.
|
|
22
29
|
class ProfilesController < ApplicationController
|
|
23
30
|
include SameOriginGuard
|
|
24
31
|
|
|
32
|
+
before_action :require_listed_profile
|
|
33
|
+
|
|
25
34
|
def data
|
|
26
35
|
blob = profile_blob(params[:key])
|
|
27
36
|
return head(:not_found) unless blob
|
|
@@ -35,7 +44,6 @@ module Wurk
|
|
|
35
44
|
|
|
36
45
|
sid = cached_sid(params[:key])
|
|
37
46
|
return redirect_to_profile(sid) if sid
|
|
38
|
-
return head(:not_found) unless profile_exists?(params[:key])
|
|
39
47
|
|
|
40
48
|
response.headers['Allow'] = 'POST'
|
|
41
49
|
head :method_not_allowed
|
|
@@ -57,7 +65,12 @@ module Wurk
|
|
|
57
65
|
redirect_to(format(::Wurk::Web.config.profile_view_url, sid), allow_other_host: true)
|
|
58
66
|
end
|
|
59
67
|
|
|
60
|
-
|
|
68
|
+
# The member's score is its expiry, the same instant the HASH's TTL lapses;
|
|
69
|
+
# ProfileSet purges expired members lazily, so a past score is gone too.
|
|
70
|
+
def require_listed_profile
|
|
71
|
+
expires_at = ::Wurk.redis { |c| c.call('ZSCORE', ::Wurk::Keys::PROFILES, params[:key].to_s) }
|
|
72
|
+
head(:not_found) unless expires_at && Float(expires_at) > ::Time.now.to_f
|
|
73
|
+
end
|
|
61
74
|
|
|
62
75
|
def cached_sid(key) = ::Wurk.redis { |c| c.call('HGET', key, 'sid') }
|
|
63
76
|
|
data/lib/wurk/api/app.rb
CHANGED
|
@@ -27,6 +27,12 @@ module Wurk
|
|
|
27
27
|
# SCRIPT_NAME (Request#url_for) — the same mount-agnostic rule the SPA shell
|
|
28
28
|
# follows in dashboard_controller.rb.
|
|
29
29
|
class App
|
|
30
|
+
# Only the failures where Redis never answered. A CommandError (WRONGTYPE,
|
|
31
|
+
# OOM) is Redis answering, so it stays an internal_error: retrying it
|
|
32
|
+
# would never succeed.
|
|
33
|
+
REDIS_OUTAGE = [::RedisClient::ConnectionError, ::ConnectionPool::TimeoutError].freeze
|
|
34
|
+
REDIS_RETRY_AFTER = 1
|
|
35
|
+
|
|
30
36
|
# `config` is read on every request rather than captured, so a token
|
|
31
37
|
# registered after the first request still takes effect. Injectable
|
|
32
38
|
# because a test must be able to hand this app its own token table
|
|
@@ -87,6 +93,8 @@ module Wurk
|
|
|
87
93
|
request.principal = principal
|
|
88
94
|
refusal = ReadOnly.refuse(request) || Throttle.refuse(request)
|
|
89
95
|
refusal || route(request)
|
|
96
|
+
rescue *REDIS_OUTAGE => e
|
|
97
|
+
redis_unavailable(request, e)
|
|
90
98
|
rescue StandardError => e
|
|
91
99
|
internal_error(request, e)
|
|
92
100
|
end
|
|
@@ -174,6 +182,18 @@ module Wurk
|
|
|
174
182
|
)
|
|
175
183
|
end
|
|
176
184
|
|
|
185
|
+
def redis_unavailable(request, error)
|
|
186
|
+
::Wurk.logger.warn { "Wurk::API #{request.request_method} #{request.path}: redis unavailable (#{error.class})" }
|
|
187
|
+
Problem.render(
|
|
188
|
+
Problem::REDIS_UNAVAILABLE,
|
|
189
|
+
status: 503,
|
|
190
|
+
detail: 'Redis is unreachable; retry after the given number of seconds.',
|
|
191
|
+
instance: request.path,
|
|
192
|
+
headers: { 'retry-after' => REDIS_RETRY_AFTER.to_s },
|
|
193
|
+
retry_after: REDIS_RETRY_AFTER
|
|
194
|
+
)
|
|
195
|
+
end
|
|
196
|
+
|
|
177
197
|
# The exception details stay in the log. A machine client gets a stable
|
|
178
198
|
# slug it can retry on, never a backtrace naming host internals.
|
|
179
199
|
def internal_error(request, error)
|
data/lib/wurk/api/problem.rb
CHANGED
|
@@ -66,6 +66,12 @@ module Wurk
|
|
|
66
66
|
# the header as a number so a client that already parses this body does
|
|
67
67
|
# not have to reach back into the headers for it.
|
|
68
68
|
RATE_LIMITED = 'rate_limited'
|
|
69
|
+
# Redis could not be reached, no pooled connection freed up in time, or
|
|
70
|
+
# the connection dropped mid-request. Separate from `internal_error`
|
|
71
|
+
# because it is worth retrying after `retry_after`. A dropped reply means
|
|
72
|
+
# a write may still have landed, so a producer retries under its
|
|
73
|
+
# `Idempotency-Key`. Matches the dashboard's own slug for the condition.
|
|
74
|
+
REDIS_UNAVAILABLE = 'redis_unavailable'
|
|
69
75
|
|
|
70
76
|
# Every slug needs a human title; `fetch` below turns a missing one into a
|
|
71
77
|
# loud failure in the test suite rather than a half-formed error body.
|
|
@@ -87,7 +93,8 @@ module Wurk
|
|
|
87
93
|
IDEMPOTENCY_KEY_REUSED => 'Idempotency Key Reused',
|
|
88
94
|
REQUEST_IN_PROGRESS => 'Request In Progress',
|
|
89
95
|
READ_ONLY => 'Read-Only Mode',
|
|
90
|
-
RATE_LIMITED => 'Too Many Requests'
|
|
96
|
+
RATE_LIMITED => 'Too Many Requests',
|
|
97
|
+
REDIS_UNAVAILABLE => 'Redis Unavailable'
|
|
91
98
|
}.freeze
|
|
92
99
|
|
|
93
100
|
module_function
|
data/lib/wurk/batch/callbacks.rb
CHANGED
|
@@ -8,7 +8,48 @@ module Wurk
|
|
|
8
8
|
# Raised by `Callbacks.enqueue_callbacks` once every callback for the event
|
|
9
9
|
# has been attempted and at least one could not be enqueued, so the caller
|
|
10
10
|
# leaves the event's dedup marker unwritten and the next fire retries it.
|
|
11
|
-
|
|
11
|
+
#
|
|
12
|
+
# `store_not_serving?` is true when a store that was not serving caused one
|
|
13
|
+
# of those failures, which is what `Callbacks.retrying` waits out.
|
|
14
|
+
class CallbackEnqueueError < StandardError
|
|
15
|
+
def initialize(message = nil, store_not_serving: false)
|
|
16
|
+
super(message)
|
|
17
|
+
@store_not_serving = store_not_serving
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def store_not_serving? = @store_not_serving
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# The callbacks one re-drive (Callbacks.retrying) has already enqueued, so
|
|
24
|
+
# a retry after a partial enqueue does not push the ones that landed again.
|
|
25
|
+
# Thread-local and scoped to the outermost re-drive.
|
|
26
|
+
module PushedCallbacks
|
|
27
|
+
KEY = :wurk_batch_callbacks_pushed
|
|
28
|
+
|
|
29
|
+
module_function
|
|
30
|
+
|
|
31
|
+
def tracking
|
|
32
|
+
owner = Thread.current[KEY].nil?
|
|
33
|
+
Thread.current[KEY] ||= Set.new
|
|
34
|
+
yield
|
|
35
|
+
ensure
|
|
36
|
+
Thread.current[KEY] = nil if owner
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Yields each item this re-drive has not landed yet; the block returns
|
|
40
|
+
# the push's error or nil. Returns the errors.
|
|
41
|
+
def push_each(bid, event, items)
|
|
42
|
+
pushed = Thread.current[KEY]
|
|
43
|
+
items.each_with_index.filter_map do |item, index|
|
|
44
|
+
key = [bid, event, index]
|
|
45
|
+
next if pushed&.include?(key)
|
|
46
|
+
|
|
47
|
+
error = yield item
|
|
48
|
+
pushed << key if pushed && error.nil?
|
|
49
|
+
error
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
12
53
|
|
|
13
54
|
# Fires batch callbacks (`:success`, `:complete`, `:death`) by enqueuing
|
|
14
55
|
# them as ordinary jobs on the batch's `callback_queue`.
|
|
@@ -35,6 +76,25 @@ module Wurk
|
|
|
35
76
|
REDRIVE_ATTEMPTS = 3
|
|
36
77
|
REDRIVE_BACKOFF = 0.05
|
|
37
78
|
|
|
79
|
+
# How long a worker-side ack or fire waits out a store that is not
|
|
80
|
+
# serving, in seconds. The quick re-drive above covers a blip; a Redis
|
|
81
|
+
# restart does not fit in it — a server loading its dataset answers
|
|
82
|
+
# LOADING at once, so all three attempts fail inside 150ms. Giving up
|
|
83
|
+
# there is the one exit that loses callbacks: the job returns, is ACKed
|
|
84
|
+
# off its private list, and nothing fires the drained batch again. Waiting
|
|
85
|
+
# is safe on every other exit — a process killed or shut down mid-wait
|
|
86
|
+
# leaves the job in its private list, and the reclaimed re-run re-drives
|
|
87
|
+
# the fire — and costs nothing, since the thread could not fetch or ACK
|
|
88
|
+
# without the store either. Bounded so a store that never comes back
|
|
89
|
+
# is still reported rather than parking the thread for good.
|
|
90
|
+
STORE_OUTAGE_BUDGET = 300
|
|
91
|
+
STORE_OUTAGE_BACKOFF = 1.0
|
|
92
|
+
|
|
93
|
+
# A command the server refused because it is not serving yet, as opposed
|
|
94
|
+
# to one it refused on its merits. Out-of-memory is deliberately absent:
|
|
95
|
+
# nothing bounds how long it lasts.
|
|
96
|
+
STORE_NOT_SERVING = /\A(?:LOADING|BUSY|CLUSTERDOWN|MASTERDOWN|READONLY|TRYAGAIN)\b/
|
|
97
|
+
|
|
38
98
|
# Runs on the post-state of a batch script that moved a member out of the
|
|
39
99
|
# live jids or pending-children set (see the gate note heading
|
|
40
100
|
# lua/batch_ack_success.lua). Fires `:complete` once both sets are empty, and
|
|
@@ -57,19 +117,41 @@ module Wurk
|
|
|
57
117
|
# REDRIVE_ATTEMPTS times in total, re-raising the last one. Every block
|
|
58
118
|
# handed to it is idempotent: the ack scripts are SREM/SADD-guarded and
|
|
59
119
|
# the fires are marker-guarded.
|
|
60
|
-
|
|
120
|
+
#
|
|
121
|
+
# With an `outage_budget`, failures caused by a store that is not serving
|
|
122
|
+
# are retried until that many seconds have passed, and do not count
|
|
123
|
+
# against REDRIVE_ATTEMPTS (see STORE_OUTAGE_BUDGET).
|
|
124
|
+
#
|
|
125
|
+
# A retry after a partial enqueue pushes only the callbacks that failed
|
|
126
|
+
# (PushedCallbacks).
|
|
127
|
+
def retrying(attempts: REDRIVE_ATTEMPTS, outage_budget: 0)
|
|
61
128
|
attempt = 0
|
|
62
|
-
|
|
129
|
+
counted = 0
|
|
130
|
+
deadline = monotonic + outage_budget
|
|
131
|
+
PushedCallbacks.tracking do
|
|
63
132
|
yield attempt
|
|
64
|
-
rescue StandardError
|
|
133
|
+
rescue StandardError => e
|
|
65
134
|
attempt += 1
|
|
66
|
-
|
|
135
|
+
outage = outage_budget.positive? && store_not_serving?(e)
|
|
136
|
+
counted += 1 unless outage
|
|
137
|
+
raise if outage ? monotonic >= deadline : counted >= attempts
|
|
67
138
|
|
|
68
|
-
sleep(REDRIVE_BACKOFF * attempt)
|
|
139
|
+
sleep(outage ? [REDRIVE_BACKOFF * attempt, STORE_OUTAGE_BACKOFF].min : REDRIVE_BACKOFF * counted)
|
|
69
140
|
retry
|
|
70
141
|
end
|
|
71
142
|
end
|
|
72
143
|
|
|
144
|
+
def store_not_serving?(error)
|
|
145
|
+
case error
|
|
146
|
+
when CallbackEnqueueError then error.store_not_serving?
|
|
147
|
+
when ::RedisClient::ConnectionError, ::ConnectionPool::TimeoutError then true
|
|
148
|
+
when ::RedisClient::CommandError then STORE_NOT_SERVING.match?(error.message.to_s)
|
|
149
|
+
else false
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def monotonic = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
|
|
154
|
+
|
|
73
155
|
# Fired from Wurk::Batch::DeathHandler whenever a death makes the died
|
|
74
156
|
# set go non-empty: the first death, or the first re-death after every
|
|
75
157
|
# dead jid was manually retried back into the live set (#212 — that
|
|
@@ -300,10 +382,12 @@ module Wurk
|
|
|
300
382
|
# Each failure reaches the error handlers; once all were attempted, any
|
|
301
383
|
# failure raises so the caller does not write the event's marker.
|
|
302
384
|
def enqueue_callbacks(bid, event)
|
|
303
|
-
|
|
304
|
-
|
|
385
|
+
items = callback_items(bid, event)
|
|
386
|
+
errors = PushedCallbacks.push_each(bid, event, items) { |item| push_callback(bid, event, item) }
|
|
387
|
+
return if errors.empty?
|
|
305
388
|
|
|
306
|
-
raise CallbackEnqueueError
|
|
389
|
+
raise CallbackEnqueueError.new("batch #{bid}: #{errors.size} #{event} callback(s) failed to enqueue",
|
|
390
|
+
store_not_serving: errors.any? { |error| store_not_serving?(error) })
|
|
307
391
|
end
|
|
308
392
|
|
|
309
393
|
def callback_items(bid, event)
|
|
@@ -318,15 +402,15 @@ module Wurk
|
|
|
318
402
|
end
|
|
319
403
|
end
|
|
320
404
|
|
|
321
|
-
#
|
|
405
|
+
# The error that kept the callback job from being enqueued, or nil.
|
|
322
406
|
def push_callback(bid, event, item)
|
|
323
407
|
Batch.with_thread_batch(nil, nil) { Wurk::Client.push(item) }
|
|
324
|
-
|
|
408
|
+
nil
|
|
325
409
|
rescue StandardError => e
|
|
326
410
|
Wurk.configuration.handle_exception(
|
|
327
411
|
e, { context: "batch #{bid}: #{event} callback #{item['args'][1].inspect} enqueue failed", bid: bid }
|
|
328
412
|
)
|
|
329
|
-
|
|
413
|
+
e
|
|
330
414
|
end
|
|
331
415
|
|
|
332
416
|
def callback_specs_for(bid)
|
|
@@ -25,7 +25,9 @@ module Wurk
|
|
|
25
25
|
bid = job['bid']
|
|
26
26
|
return unless bid
|
|
27
27
|
|
|
28
|
-
Callbacks.retrying
|
|
28
|
+
Callbacks.retrying(outage_budget: Callbacks::STORE_OUTAGE_BUDGET) do |attempt|
|
|
29
|
+
record(bid, job['jid'], replay: attempt.positive?)
|
|
30
|
+
end
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
def self.record(bid, jid, replay:)
|
|
@@ -26,7 +26,9 @@ module Wurk
|
|
|
26
26
|
# itself is retried in-process and only raises (sending the job to retry,
|
|
27
27
|
# at-least-once) when Redis stays unreachable — a jid left in the live set
|
|
28
28
|
# would hold the batch open forever. The fire after it never raises: it is
|
|
29
|
-
# re-driven in-process and then reported to the error handlers.
|
|
29
|
+
# re-driven in-process and then reported to the error handlers. Both wait
|
|
30
|
+
# out a store that is not serving (Callbacks::STORE_OUTAGE_BUDGET): once
|
|
31
|
+
# this job is ACKed nothing re-drives a fire that gave up.
|
|
30
32
|
#
|
|
31
33
|
# Invalidated batches short-circuit: the job is skipped without
|
|
32
34
|
# raising — counts as a "success" for batch purposes per spec §12.
|
|
@@ -104,14 +106,16 @@ module Wurk
|
|
|
104
106
|
# state: if the batch is drained, the dead run's fire may never have
|
|
105
107
|
# happened, and the callback markers absorb it if it did.
|
|
106
108
|
def ack_success(bid, jid)
|
|
107
|
-
_removed, pending, live, kids = Callbacks.retrying do
|
|
109
|
+
_removed, pending, live, kids = Callbacks.retrying(outage_budget: Callbacks::STORE_OUTAGE_BUDGET) do
|
|
108
110
|
redis_pool.with { |conn| Batch.ack_success(conn, bid, jid) }
|
|
109
111
|
end
|
|
110
112
|
fire(bid, pending, live, kids)
|
|
111
113
|
end
|
|
112
114
|
|
|
113
115
|
def fire(bid, pending, live, kids)
|
|
114
|
-
Callbacks.retrying
|
|
116
|
+
Callbacks.retrying(outage_budget: Callbacks::STORE_OUTAGE_BUDGET) do
|
|
117
|
+
Callbacks.maybe_fire(bid, pending: pending, live: live, kids: kids)
|
|
118
|
+
end
|
|
115
119
|
rescue StandardError => e
|
|
116
120
|
error_config.handle_exception(e, { context: "batch #{bid}: firing callbacks after ack", bid: bid })
|
|
117
121
|
end
|
data/lib/wurk/capsule.rb
CHANGED
|
@@ -21,6 +21,20 @@ module Wurk
|
|
|
21
21
|
# Sidekiq delegates the same accessor (capsule.rb:30).
|
|
22
22
|
def thread_priority = @config.thread_priority
|
|
23
23
|
|
|
24
|
+
# Hash-style options live on the Configuration; Sidekiq delegates these
|
|
25
|
+
# too (capsule.rb:30), and fetchers and gems handed a capsule read them.
|
|
26
|
+
def [](key) = @config[key]
|
|
27
|
+
|
|
28
|
+
def []=(key, val)
|
|
29
|
+
@config[key] = val
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def fetch(*, &) = @config.fetch(*, &)
|
|
33
|
+
def key?(key) = @config.key?(key)
|
|
34
|
+
alias has_key? key?
|
|
35
|
+
def merge!(other) = @config.merge!(other)
|
|
36
|
+
def dig(*keys) = @config.dig(*keys)
|
|
37
|
+
|
|
24
38
|
def initialize(name, config)
|
|
25
39
|
@name = name.to_s
|
|
26
40
|
@config = config
|