Main Koha release repository https://koha-community.org
Find a file
Tomas Cohen Arazi 1a51c2e973
Bug 35819: Notify NACK and requeue when Job ID not found
This patch makes the worker reject the incoming frame for putting the
message back in the queue, in the event the job id doesn't exist yet.
Which is the case when some actions are being triggered inside a
transaction which hasn't been commited to the DB yet.

To test you will need 3 KTD shells
(a) mysql:
   $ ktd --shell
  k$ sudo koha-mysql kohadev

(b) logs:
   $ ktd --shell
   # for restarting the worker and looking at the logs
  k$ sudo koha-worker --restart kohadev  ; tail -f /var/log/koha/kohadev/worker-*.log
(c) running the test:
   $ ktd --shell

1. Have (a), (b) and (c) terminals ready
2. On (c), run:
   $ perl -MKoha::Database -MKoha::BackgroundJob::BatchUpdateBiblioHoldsQueue -e 'Koha::Database->schema->txn_do( sub { Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue({ biblio_ids => [ 1 ] }); sleep 1;  } );'
=> FAIL:
   * (b) shows (once) an error about a job not existing
3. On (a) run:
   > SELECT * FROM background_jobs;
=> FAIL: Notice the job ID mentioned on 2 stands as 'new'.
4. Apply this patch
5. Ctrl+c on (b), and re-run to launch the worker with the patch applied
6. Repeat 2
=> SUCCESS (partial): The error about the job not existing is displayed
many times
7. Repeat 3
=> SUCCESS: The job ID mentioned on 6 stands as 'finished'.
8. Sign off :-D

Discussion:

* The `requeue` header I added is correct, but it is the default
  behavior anyway. I prefered to make it explicit, though.

* To avoid that bunch of retries, we should requeue with some delay. I
  didn't manage to make it work (yet) but there's a 'delay' plugin for
  rabbit [1]. We already install the 'stomp' plugin in
  koha-common.postinst. But this plugin requires downloading it. Which
  would require further investigation.

* As Nick and Marcel pointed, we need to revisit the whole architecture,
  the need of a MQ (DB polling wouldn't have this problem), etc. But
  that's for another place.

[1] https://hevodata.com/learn/rabbitmq-delayed-message/#:~:text=To%20delay%20a%20message%2C%20the,to%20queues%20or%20other%20exchanges.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 16:36:36 +01:00
acqui Bug 34478: Manual fix - reopen basket - add cud- - basket.tt 2024-03-01 11:00:23 +01:00
admin Bug 34478: Replace delete links with form - smart-rules 2024-03-01 11:00:15 +01:00
api Bug 35368: Add public to "Add a new checkout" in API documentation 2024-01-30 17:48:40 +01:00
authorities Bug 34478: Regression - fix change auth type 2024-03-01 10:59:15 +01:00
basket Bug 34478: Add 'op' to sendbasketform 2024-03-01 10:58:53 +01:00
bin Bug 20582: Turn Koha into a Mojolicious application 2020-10-06 12:00:04 +02:00
bookings Bug 35574: Bookings tab from biblio details should only require manage_bookings permission 2023-12-18 15:21:04 +01:00
C4 Bug 36148: Do not deal with CSRF error in get_template_and_user 2024-03-01 11:01:07 +01:00
catalogue Bug 36000: Fix CGI::param warning in catalogue search 2024-03-07 15:02:43 +01:00
cataloguing Bug 34478: Fix delallitems for additem 2024-03-01 11:00:19 +01:00
circ Bug 36175: Corrections to reduced due for booked items 2024-03-07 16:36:32 +01:00
clubs Bug 34478: Manual fix - add op clubs/templates-add-modify 2024-03-01 10:57:55 +01:00
course_reserves Bug 34478: Manual fix - Course reserves 2024-03-01 10:56:56 +01:00
debian Bug 36009: Document koha-worker --queue elastic_index 2024-03-07 15:02:48 +01:00
docs Bug 35504: Split list of ERM Topic experts 2024-01-11 15:44:51 +01:00
erm Bug 32922: Remove space in shebang 2023-02-20 09:44:06 -03:00
errors Bug 36148: Improve error handling and restore programming errors 2024-03-01 11:01:06 +01:00
etc Bug 35086: (follow-up) Use 5000 as example in conf file 2024-01-16 12:06:02 +01:00
ill Bug 36245: Remove cud- from op 2024-03-07 16:36:36 +01:00
installer Bug 36102: Fix removal of cookie from the installer session on upgrades 2024-03-01 11:00:36 +01:00
Koha Bug 36249: Fix generic_confirm op 2024-03-07 16:36:35 +01:00
koha-tmpl Bug 36249: Fix styling of 'Send email' button 2024-03-07 16:36:35 +01:00
labels Bug 34478: Update label ops 'edit' to 'edit_form' 2024-03-01 10:56:33 +01:00
lib/CGI/Session/Serialize Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
members Bug 35329: Move patron search to modal - remove members/search.pl 2024-03-01 11:01:15 +01:00
misc Bug 35819: Notify NACK and requeue when Job ID not found 2024-03-07 16:36:36 +01:00
offline_circ Bug 34478: Changes for offline_circ 2024-03-01 10:58:34 +01:00
opac Bug 35952: Remove unnecessary line for OpacSuppressionMessage 2024-03-07 15:02:50 +01:00
patron_lists Bug 34478: Changes for patron_lists/add-modify 2024-03-01 10:57:41 +01:00
patroncards Bug 34478: (follow-up) patroncards: FIXMEs for op and missing script 2024-03-01 11:00:00 +01:00
plugins Bug 34478: op =~ ^cud- in pl/pm 2024-03-01 10:56:11 +01:00
pos Bug 34478: Manual fix - add op - pos/pay 2024-03-01 10:57:34 +01:00
preservation Bug 34030: Add a "print slips" action links to print in batch 2023-10-23 11:33:55 -03:00
recalls Bug 34478: op =~ ^cud- in pl/pm 2024-03-01 10:56:11 +01:00
reports Bug 34478: Manual fix - change 'phase' to 'op' add cud- - mana-share-report 2024-03-01 10:59:08 +01:00
reserve Bug 34478: Manual fix - change links to JS form submission - change action to op - request.pl/.tt 2024-03-01 10:59:09 +01:00
reviews Bug 34478: op =~ ^cud- in pl/pm 2024-03-01 10:56:11 +01:00
rotating_collections Bug 34478: Manual fix - add op - rotating_collections/addItems 2024-03-01 10:57:33 +01:00
serials Bug 35329: Handle duplicate without 500 2024-03-01 11:01:26 +01:00
services Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
skel Bug 11078: Add locking to rebuild_zebra 2014-02-28 22:21:41 +00:00
suggestion Bug 34478: Changes for suggestion/suggestion 2024-03-01 10:59:26 +01:00
svc Bug 36084: svc - mana 2024-03-01 11:01:01 +01:00
t Bug 35963: (QA follow-up): tidy up code and fix exec permission 2024-03-07 15:02:52 +01:00
tags Bug 34478: Add 'op' to tags/review 2024-03-01 10:58:25 +01:00
tools Bug 34478: Correct op name in CSV profile deletion confirmation step 2024-03-01 11:00:07 +01:00
virtualshelves Bug 34478: Correct op name for list edit confirmation 2024-03-01 11:00:09 +01:00
xt Bug 34478: Add test to catch missing op in POST forms 2024-03-01 10:58:14 +01:00
.editorconfig Bug 27375: Set YAML file settings in .editorconfig 2021-11-03 15:40:52 +01:00
.eslintrc.json Bug 23834: Add default ESLint configuration 2019-11-03 08:02:39 +00:00
.gitignore Bug 35174: Add misc/translator/po to .gitignore 2023-11-16 08:56:36 +01:00
.htaccess Fix file permissions: if it is not a script, it should not be executable. 2010-04-16 00:40:34 -04:00
.mailmap 23.11.00: Update mailmap 2023-11-30 14:58:47 -03:00
.perlcriticrc Bug 25898: Prohibit indirect object notation 2020-10-15 12:56:30 +02:00
.perltidyrc Bug 30002: Adjust perltidy 2023-06-08 08:32:42 -03:00
.proverc.dist Bug 19821: Install sample data, ES mappings and Version syspref 2021-10-25 11:27:40 +02:00
.stylelintrc.json Bug 31528: (follow-up) A few additional rules 2022-10-03 08:23:15 -03:00
about.pl Bug 35504: Distinguish different RMaint and Topic Expert roles 2024-01-11 15:44:52 +01:00
app.psgi Bug 20582: Fix PSGI file when behind a reverse proxy 2020-10-06 12:00:04 +02:00
build-resources.PL Bug 32609: Use the current yarn.lock to generate node_modules 2023-02-10 11:07:57 -03:00
changelanguage.pl Bug 25898: Prohibit indirect object notation 2020-10-15 12:56:30 +02:00
cpanfile Bug 34064: Add SQL::Translator dependency to cpanfile 2023-10-10 10:54:04 -03:00
cypress.config.ts Bug 34319: Upgrade cypress 9.7.0 to 12.17.2 2023-09-05 11:52:25 -03:00
fix-perl-path.PL Bug 28606: Remove $DEBUG and $ENV{DEBUG} 2021-06-24 11:53:44 +02:00
gulpfile.js Bug 35428: Remove temporary files for gulp po tasks 2023-12-12 15:04:54 +01:00
help.pl Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
INSTALL Bug 26617: Update INSTALL file to include koha-testing-docker and Gitlab links 2020-10-15 12:56:30 +02:00
Koha.pm Bug 30230: DBRev 23.12.00.006 2024-01-29 12:25:11 +01:00
koha_perl_deps.pl Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
kohaversion.pl Bug 26384: Fix executable flags 2020-09-11 09:56:56 +02:00
LICENSE Bug 9440 - update Koha's LICENSE file from GPL2 to GPL3 2013-02-12 08:52:10 -05:00
mainpage.pl Bug 34478: Remove generate_csrf from pl 2024-03-01 10:55:56 +01:00
Makefile.PL Bug 35759: (bug 30708 follow-up) Generated dist file not installed for preservation module 2024-01-16 12:06:17 +01:00
MANIFEST.SKIP Bug 9546 : Updating make manifest tardist 2013-02-06 23:54:46 -05:00
package.json Bug 34319: Upgrade cypress 9.7.0 to 12.17.2 2023-09-05 11:52:25 -03:00
README Bug 9440 - update Koha's LICENSE file from GPL2 to GPL3 2013-02-12 08:52:10 -05:00
README.md Bug 27092: Remove note about "synced repo" from README.md 2020-11-25 16:31:58 +01:00
README.robots Bug 6411 add another example to README.robots 2011-07-05 14:48:05 +12:00
rewrite-config.PL Bug 28519: Put CGI::Session::Serialize::yamlxs in lib directory 2021-06-17 10:07:36 +02:00
tsconfig.json Bug 32030: Move cypress to t - fix build_js/watch_js 2022-11-08 09:44:52 -03:00
webpack.config.js Bug 30708: Vue app 2023-10-18 15:41:40 -03:00
yarn.lock Bug 34319: Update yarn.lock 2023-09-05 11:52:25 -03:00

Koha is a free software integrated library system (ILS).

Koha is distributed under the GNU GPL version 3 or later.

Note: Koha does not accept pull requests from git hosting sites.

Note: This project has its own bug tracker, to report a bug or submit a patch visit http://bugs.koha-community.org.

For guidelines on submitting patches for Koha please visit https://wiki.koha-community.org/wiki/SubmitingAPatch

The developers handbook can be found at https://wiki.koha-community.org/wiki/Developer_handbook

http://koha-community.org/

Koha Logo