Skip to content

Fix on_commit jobs in sync mode - #137

Merged
ecarreras merged 1 commit into
api_v5from
fix-on-commit-sync
Jul 14, 2026
Merged

ecarreras merged 1 commit into
api_v5from
fix-on-commit-sync

Conversation

@giscebot

@giscebot giscebot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Resumen

  • Respeta on_commit=True también cuando OORQ_ASYNC=False.
  • Añade una regresión que comprueba que el job síncrono no se ejecuta antes del commit() y sí después.

Contexto

Con OORQ_ASYNC=False, Queue(..., is_async=False).enqueue(...) ejecuta el job inmediatamente. Hasta ahora @job(on_commit=True) solo difería el enqueue si async_mode era true, así que el modo síncrono ignoraba la semántica transaccional.

La solución reutiliza el mecanismo existente de ProcessJobs conectado a DB_CURSOR_COMMIT/ROLLBACK: si on_commit=True, el job se registra siempre y se encola en el commit. En modo síncrono, RQ lo ejecuta entonces, no antes.

Validación

  • RED confirmado antes del cambio: TestOORQSyncOnCommit.test_write_sync_on_commit_waits_for_commit fallaba porque el read previo al commit() ya veía active=True.
  • GREEN después del cambio:
    • destral -m test_oorq -t test_oorq.TestOORQSyncOnCommit.test_write_sync_on_commit_waits_for_commit -d test_7cd760f88b45457c8344eb3c95106970 --no-dropdb --no-requirements
  • python -m py_compile oorq/decorators.py oorq/tests/test_oorq/tests/test_oorq.py en Python 2.7 y Python 3.11.
  • git diff --check.

Nota: la suite completa local destral -m test_oorq queda afectada por flakiness/estado local de workers Redis en tests preexistentes (split_job y TaskManager). No he cambiado esos caminos en esta PR.

Relacionado

  • Origen de la tarea: TASK-85718

Co-authored-by: Eduard Carreras <ecarreras@gisce.net>
@giscebot giscebot self-assigned this Jul 7, 2026
@giscebot
giscebot requested a review from ecarreras July 7, 2026 13:35
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Python oorq redis 3 2.7 Tests for test_oorq

 2 files   2 suites   39s ⏱️
97 tests 97 ✅ 0 💤 0 ❌
98 runs  98 ✅ 0 💤 0 ❌

Results for commit b9fc3b3.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Python oorq redis 5 3.11 Tests for test_oorq

 2 files   2 suites   39s ⏱️
97 tests 97 ✅ 0 💤 0 ❌
98 runs  98 ✅ 0 💤 0 ❌

Results for commit b9fc3b3.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Python oorq valkey 8 3.11 Tests for test_oorq

 2 files   2 suites   39s ⏱️
97 tests 97 ✅ 0 💤 0 ❌
98 runs  98 ✅ 0 💤 0 ❌

Results for commit b9fc3b3.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Python oorq redis 7 3.11 Tests for test_oorq

 2 files   2 suites   39s ⏱️
97 tests 97 ✅ 0 💤 0 ❌
98 runs  98 ✅ 0 💤 0 ❌

Results for commit b9fc3b3.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Python oorq redis 7 2.7 Tests for test_oorq

 2 files   2 suites   39s ⏱️
97 tests 97 ✅ 0 💤 0 ❌
98 runs  98 ✅ 0 💤 0 ❌

Results for commit b9fc3b3.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Python oorq valkey 8 2.7 Tests for test_oorq

 2 files   2 suites   39s ⏱️
97 tests 97 ✅ 0 💤 0 ❌
98 runs  98 ✅ 0 💤 0 ❌

Results for commit b9fc3b3.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Python oorq redis 3 3.11 Tests for test_oorq

 2 files   2 suites   39s ⏱️
97 tests 97 ✅ 0 💤 0 ❌
98 runs  98 ✅ 0 💤 0 ❌

Results for commit b9fc3b3.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Python oorq redis 5 2.7 Tests for test_oorq

 2 files   2 suites   39s ⏱️
97 tests 97 ✅ 0 💤 0 ❌
98 runs  98 ✅ 0 💤 0 ❌

Results for commit b9fc3b3.

@ecarreras
ecarreras requested a review from polsala July 7, 2026 13:44
@ecarreras
ecarreras merged commit a647233 into api_v5 Jul 14, 2026
16 checks passed
@ecarreras
ecarreras deleted the fix-on-commit-sync branch July 14, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants