[Django] #33054: Support post-commit hooks adding more post-commit hooks

4 views
Skip to first unread message

Django

unread,
Aug 25, 2021, 2:22:56 AM8/25/21
to django-...@googlegroups.com
#33054: Support post-commit hooks adding more post-commit hooks
-------------------------------------+-------------------------------------
Reporter: Eugene | Owner: nobody
Morozov |
Type: New | Status: new
feature |
Component: Database | Version: 3.2
layer (models, ORM) |
Severity: Normal | Keywords: on_commit
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Sometimes there's a need to add additional on_commit callback from
on_commit callback. For example, on_commit callback saves some model, but
post_save handler for that model also uses on_commit callback to perform
some additional action (e.g. spawn celery task). Current Django code
ignores new callbacks added during on_commit callback execution.

I present a simple solution for this problem:
https://github.com/django/django/pull/14796

--
Ticket URL: <https://code.djangoproject.com/ticket/33054>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 25, 2021, 2:27:53 AM8/25/21
to django-...@googlegroups.com
#33054: Support post-commit hooks adding more post-commit hooks
-------------------------------------+-------------------------------------
Reporter: Evgenii Morozov | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: on_commit | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* cc: Adam Johnson (added)
* stage: Unreviewed => Accepted


Comment:

Sounds reasonable. Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/33054#comment:1>

Django

unread,
Aug 25, 2021, 2:49:07 AM8/25/21
to django-...@googlegroups.com
#33054: Make captureOnCommitCallbacks capture callbacks added by callbacks

-------------------------------------+-------------------------------------
Reporter: Evgenii Morozov | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: on_commit | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/33054#comment:2>

Django

unread,
Aug 25, 2021, 3:13:33 AM8/25/21
to django-...@googlegroups.com
#33054: Make captureOnCommitCallbacks capture callbacks added by callbacks
-------------------------------------+-------------------------------------
Reporter: Evgenii Morozov | Owner: Evgenii
| Morozov
Type: New feature | Status: assigned

Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: on_commit | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: nobody => Evgenii Morozov
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/33054#comment:3>

Django

unread,
Aug 25, 2021, 2:20:23 PM8/25/21
to django-...@googlegroups.com
#33054: Make captureOnCommitCallbacks capture callbacks added by callbacks
-------------------------------------+-------------------------------------
Reporter: Evgenii Morozov | Owner: Evgenii
| Morozov
Type: New feature | Status: assigned
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: on_commit | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_docs: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/33054#comment:4>

Django

unread,
Aug 30, 2021, 1:10:03 AM8/30/21
to django-...@googlegroups.com
#33054: Make captureOnCommitCallbacks capture callbacks added by callbacks
-------------------------------------+-------------------------------------
Reporter: Evgenii Morozov | Owner: Evgenii
| Morozov
Type: New feature | Status: assigned
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: on_commit | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_docs: 1 => 0
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/33054#comment:5>

Django

unread,
Aug 30, 2021, 1:15:41 AM8/30/21
to django-...@googlegroups.com
#33054: Make captureOnCommitCallbacks capture callbacks added by callbacks
-------------------------------------+-------------------------------------
Reporter: Evgenii Morozov | Owner: Evgenii
| Morozov
Type: New feature | Status: assigned
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: on_commit | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Evgenii Morozov:

Old description:

> Sometimes there's a need to add additional on_commit callback from
> on_commit callback. For example, on_commit callback saves some model, but
> post_save handler for that model also uses on_commit callback to perform
> some additional action (e.g. spawn celery task). Current Django code
> ignores new callbacks added during on_commit callback execution.
>
> I present a simple solution for this problem:
> https://github.com/django/django/pull/14796

New description:

Sometimes there's a need to add additional on_commit callback from
on_commit callback. For example, on_commit callback saves some model, but
post_save handler for that model also uses on_commit callback to perform

some additional action (e.g. spawn celery task). Current Django TestCase


code ignores new callbacks added during on_commit callback execution.

I present a simple solution for this problem:
https://github.com/django/django/pull/14796

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33054#comment:6>

Django

unread,
Aug 30, 2021, 3:15:15 AM8/30/21
to django-...@googlegroups.com
#33054: Make captureOnCommitCallbacks capture callbacks added by callbacks
-------------------------------------+-------------------------------------
Reporter: Evgenii Morozov | Owner: Evgenii
| Morozov
Type: New feature | Status: closed

Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: on_commit | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"d89f976bddb49fb168334960acc8979c3de991fa" d89f976b]:
{{{
#!CommitTicketReference repository=""
revision="d89f976bddb49fb168334960acc8979c3de991fa"
Fixed #33054 -- Made TestCase.captureOnCommitCallbacks() capture callbacks
recursively.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33054#comment:7>

Reply all
Reply to author
Forward
0 new messages