Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Castellum
castellum_scheduler
Commits
10f3ed33
Commit
10f3ed33
authored
Aug 24, 2021
by
Bengfort
Browse files
use jobs instead of requests to ping castellum
parent
b2901d6b
Pipeline
#10979
passed with stages
in 2 minutes and 7 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
scheduler/main/views.py
View file @
10f3ed33
...
...
@@ -16,6 +16,7 @@
# License along with Castellum. If not, see
# <http://www.gnu.org/licenses/>.
import
json
from
collections
import
OrderedDict
from
django.conf
import
settings
...
...
@@ -36,7 +37,7 @@ from django.views.generic import ListView
from
django.views.generic
import
UpdateView
from
django.views.generic
import
View
import
request
s
from
scheduler.jobs
import
helpers
as
job
s
from
.forms
import
ScheduleForm
from
.models
import
Invitation
...
...
@@ -124,12 +125,13 @@ class InvitationUpdateView(UpdateView):
def
form_valid
(
self
,
form
,
*
args
):
ok
=
True
response
=
super
().
form_valid
(
form
,
*
args
)
if
settings
.
PING_URL
:
r
=
requests
.
post
(
settings
.
PING_URL
.
format
(
schedule_id
=
self
.
object
.
schedule
.
id
,
token
=
self
.
object
.
token
,
))
ok
=
r
.
ok
try
:
ok
=
jobs
.
request
(
json
.
dumps
({
'schedule'
:
self
.
object
.
schedule
.
id
,
'token'
:
self
.
object
.
token
,
}))
except
TimeoutError
:
ok
=
False
if
ok
:
messages
.
success
(
self
.
request
,
_
(
'Your booking has been saved.'
))
else
:
...
...
setup.cfg
View file @
10f3ed33
...
...
@@ -11,7 +11,6 @@ install_requires =
Django == 3.2.6
django-bootstrap4 == 3.0.1
django-npm == 1.0.0
requests == 2.26.0
[options.extras_require]
test =
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment