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
SRCT
mason-today-web
Commits
57e7b1ed
Commit
57e7b1ed
authored
Aug 10, 2018
by
Aaron R Poulter-martinez
Browse files
changed code from creating new thread to creating new process
parent
b83c2302
Changes
1
Hide whitespace changes
Inline
Side-by-side
mason-today/__init__.py
View file @
57e7b1ed
...
@@ -6,6 +6,7 @@ from flask import render_template
...
@@ -6,6 +6,7 @@ from flask import render_template
# app imports
# app imports
from
appmethods
import
update_both_dbs
,
run_schedule_loop
from
appmethods
import
update_both_dbs
,
run_schedule_loop
from
redisactions
import
redisdb
from
redisactions
import
redisdb
from
multiprocessing
import
Process
# python imports
# python imports
import
json
import
json
...
@@ -45,13 +46,18 @@ def get_last_update():
...
@@ -45,13 +46,18 @@ def get_last_update():
return
resp
return
resp
# make sure the cacheing is set up on init
update_both_dbs
()
# make sure the cacheing is set up on init
try
:
try
:
thread
.
start_new_thread
(
run_schedule_loop
,
())
pUpdate
=
Process
(
target
=
update_both_dbs
,
args
=
())
print
"started thread!"
pSchedule
=
Process
(
target
=
run_schedule_loop
,
args
=
())
except
:
pSchedule
.
start
()
pUpdate
.
start
()
print
(
"Process Started!"
)
except
Exception
as
e
:
print
(
e
)
print
"==================================================="
\
print
"==================================================="
\
+
"Unable to start scheduling thread"
\
+
"Unable to start scheduling thread"
\
+
"==================================================="
+
traceback
.
print_exc
(
file
=
sys
.
stdout
)
\
+
"==================================================="
\ No newline at end of file
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