Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pretix Matrix Inviter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KIF
Pretix Matrix Inviter
Commits
06cd41b9
Commit
06cd41b9
authored
1 year ago
by
Felix Schäfer
Browse files
Options
Downloads
Patches
Plain Diff
Schedule tasks only after DB transactions are committed
https://github.com/pretix/pretix/issues/3630
parent
64eb2c17
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+2
-0
2 additions, 0 deletions
CHANGELOG.md
pretix_matrix_inviter/forms.py
+4
-12
4 additions, 12 deletions
pretix_matrix_inviter/forms.py
pretix_matrix_inviter/tasks.py
+3
-3
3 additions, 3 deletions
pretix_matrix_inviter/tasks.py
with
9 additions
and
15 deletions
CHANGELOG.md
+
2
−
0
View file @
06cd41b9
...
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
...
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to
[
Semantic Versioning
](
https://semver.org/spec/v2.0.0.html
)
.
and this project adheres to
[
Semantic Versioning
](
https://semver.org/spec/v2.0.0.html
)
.
## [Unreleased]
## [Unreleased]
### Fixed
-
Schedule tasks only after DB transactions are committed
## [1.7.0] - 2023-02-09
## [1.7.0] - 2023-02-09
### Added
### Added
...
...
This diff is collapsed.
Click to expand it.
pretix_matrix_inviter/forms.py
+
4
−
12
View file @
06cd41b9
from
django.core.exceptions
import
ValidationError
import
re
from
django.core.validators
import
URLValidator
from
django.forms
import
(
from
django.forms
import
(
CharField
,
CharField
,
CheckboxSelectMultiple
,
CheckboxSelectMultiple
,
...
@@ -8,8 +9,6 @@ from django.forms import (
...
@@ -8,8 +9,6 @@ from django.forms import (
from
django.utils.translation
import
gettext_lazy
from
django.utils.translation
import
gettext_lazy
from
i18nfield.forms
import
I18nFormField
,
I18nTextInput
from
i18nfield.forms
import
I18nFormField
,
I18nTextInput
from
pretix.base.forms
import
SettingsForm
from
pretix.base.forms
import
SettingsForm
from
urllib3.exceptions
import
LocationParseError
from
urllib3.util
import
parse_url
from
.helpers
import
matrix_room_info_for_event
from
.helpers
import
matrix_room_info_for_event
...
@@ -31,9 +30,10 @@ class MatrixInviterSettingsForm(SettingsForm):
...
@@ -31,9 +30,10 @@ class MatrixInviterSettingsForm(SettingsForm):
"
your own Matrix account but from a dedicated Matrix account.
"
"
your own Matrix account but from a dedicated Matrix account.
"
),
),
)
)
matrix_inviter_matrix_server
=
Char
Field
(
matrix_inviter_matrix_server
=
Regex
Field
(
label
=
gettext_lazy
(
"
Matrix server
"
),
label
=
gettext_lazy
(
"
Matrix server
"
),
strip
=
True
,
strip
=
True
,
regex
=
re
.
compile
(
r
"
^
"
+
URLValidator
.
host_re
+
r
"
\Z
"
,
re
.
IGNORECASE
),
help_text
=
gettext_lazy
(
help_text
=
gettext_lazy
(
"
The matrix server the above access token is valid for.
"
"
The matrix server the above access token is valid for.
"
),
),
...
@@ -61,14 +61,6 @@ class MatrixInviterSettingsForm(SettingsForm):
...
@@ -61,14 +61,6 @@ class MatrixInviterSettingsForm(SettingsForm):
strip
=
True
,
strip
=
True
,
)
)
def
clean_matrix_inviter_matrix_server
(
self
):
url
=
self
.
cleaned_data
[
"
matrix_inviter_matrix_server
"
]
try
:
return
parse_url
(
url
).
host
except
LocationParseError
:
raise
ValidationError
(
"
Please enter a valid hostname
"
)
return
url
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
super
().
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
"
matrix_inviter_items
"
].
choices
=
[
self
.
fields
[
"
matrix_inviter_items
"
].
choices
=
[
...
...
This diff is collapsed.
Click to expand it.
pretix_matrix_inviter/tasks.py
+
3
−
3
View file @
06cd41b9
...
@@ -2,7 +2,7 @@ import logging
...
@@ -2,7 +2,7 @@ import logging
import
requests
import
requests
from
celery.exceptions
import
MaxRetriesExceededError
from
celery.exceptions
import
MaxRetriesExceededError
from
pretix.base.models
import
Order
,
OrderPosition
from
pretix.base.models
import
Order
,
OrderPosition
from
pretix.base.services.tasks
import
ProfiledEventTask
from
pretix.base.services.tasks
import
TransactionAware
ProfiledEventTask
from
pretix.celery_app
import
app
from
pretix.celery_app
import
app
from
urllib.parse
import
quote
as
url_quote
from
urllib.parse
import
quote
as
url_quote
...
@@ -12,7 +12,7 @@ logger = logging.getLogger(__name__)
...
@@ -12,7 +12,7 @@ logger = logging.getLogger(__name__)
@app.task
(
@app.task
(
base
=
ProfiledEventTask
,
base
=
TransactionAware
ProfiledEventTask
,
bind
=
True
,
bind
=
True
,
max_retries
=
10
,
max_retries
=
10
,
retry_backoff
=
True
,
retry_backoff
=
True
,
...
@@ -98,7 +98,7 @@ def matrix_inviter_invite(
...
@@ -98,7 +98,7 @@ def matrix_inviter_invite(
@app.task
(
@app.task
(
base
=
ProfiledEventTask
,
base
=
TransactionAware
ProfiledEventTask
,
bind
=
True
,
bind
=
True
,
max_retries
=
10
,
max_retries
=
10
,
retry_backoff
=
True
,
retry_backoff
=
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