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
c82be665
Verified
Commit
c82be665
authored
4 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Replace default app Task with a task that runs on_commit
parent
9e8b9077
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!491
Resolve "Make Celery non-optional"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/core/celery.py
+13
-0
13 additions, 0 deletions
aleksis/core/celery.py
with
13 additions
and
0 deletions
aleksis/core/celery.py
+
13
−
0
View file @
c82be665
import
os
from
django.db
import
transaction
from
celery
import
Celery
os
.
environ
.
setdefault
(
"
DJANGO_SETTINGS_MODULE
"
,
"
aleksis.core.settings
"
)
...
...
@@ -7,3 +9,14 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "aleksis.core.settings")
app
=
Celery
(
"
aleksis
"
)
# noqa
app
.
config_from_object
(
"
django.conf:settings
"
,
namespace
=
"
CELERY
"
)
app
.
autodiscover_tasks
()
class
OnCommitTask
(
app
.
Task
):
"""
Task that is delayed at least until the current transaction commits.
"""
def
delay
(
self
,
*
args
,
**
kwargs
):
def
_real_delay
():
return
super
().
delay
(
*
args
,
**
kwargs
)
transaction
.
on_commit
(
_real_delay
)
app
.
Task
=
OnCommitTask
This diff is collapsed.
Click to expand it.
Nik | Klampfradler
@nik
mentioned in commit
d69e7ac6
·
4 years ago
mentioned in commit
d69e7ac6
mentioned in commit d69e7ac6253c6cdd36d82beff7b4f2b6c2afc447
Toggle commit list
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