Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
c1a2e1c5
Commit
c1a2e1c5
authored
4 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Plain Diff
Merge branch 'issue-345' into 'master'
Delay all celery task creations to on_commit Closes
#345
See merge request
!434
parents
e9923d88
feca4d58
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!434
Delay all celery task creations to on_commit
Pipeline
#5201
passed
4 years ago
Stage: test
Stage: build
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/core/models.py
+1
-1
1 addition, 1 deletion
aleksis/core/models.py
aleksis/core/util/core_helpers.py
+2
-1
2 additions, 1 deletion
aleksis/core/util/core_helpers.py
with
3 additions
and
2 deletions
aleksis/core/models.py
+
1
−
1
View file @
c1a2e1c5
...
...
@@ -494,7 +494,7 @@ class Notification(ExtensibleModel, TimeStampedModel):
def
save
(
self
,
**
kwargs
):
super
().
save
(
**
kwargs
)
if
not
self
.
sent
:
transaction
.
on_commit
(
lambda
:
send_notification
(
self
.
pk
,
resend
=
True
)
)
send_notification
(
self
.
pk
,
resend
=
True
)
self
.
sent
=
True
super
().
save
(
**
kwargs
)
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/util/core_helpers.py
+
2
−
1
View file @
c1a2e1c5
...
...
@@ -14,6 +14,7 @@ else:
import
importlib_metadata
as
metadata
from
django.conf
import
settings
from
django.db
import
transaction
from
django.db.models
import
Model
,
QuerySet
from
django.http
import
HttpRequest
from
django.shortcuts
import
get_object_or_404
...
...
@@ -209,7 +210,7 @@ def celery_optional(orig: Callable) -> Callable:
def
wrapped
(
*
args
,
**
kwargs
):
if
is_celery_enabled
():
return
task
.
delay
(
*
args
,
**
kwargs
),
False
return
transaction
.
on_commit
(
lambda
:
task
.
delay
(
*
args
,
**
kwargs
)
)
,
False
else
:
return
orig
(
*
args
,
**
kwargs
),
True
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment