Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
9b9e29a3
Commit
9b9e29a3
authored
Aug 30, 2020
by
blitzmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement worker thread as a daemon
parent
e7eb5b6e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
19 deletions
+18
-19
worker.py
cps/services/worker.py
+18
-19
No files found.
cps/services/worker.py
View file @
9b9e29a3
...
...
@@ -59,7 +59,7 @@ class WorkerThread(threading.Thread):
threading
.
Thread
.
__init__
(
self
)
self
.
dequeued
=
list
()
self
.
daemon
=
True
self
.
doLock
=
threading
.
Lock
()
self
.
queue
=
ImprovedQueue
()
self
.
num
=
0
...
...
@@ -101,10 +101,9 @@ class WorkerThread(threading.Thread):
# Main thread loop starting the different tasks
def
run
(
self
):
main_thread
=
_get_main_thread
()
while
main_thread
.
is_alive
():
# this blocks until something is available
item
=
self
.
queue
.
get
()
with
self
.
doLock
:
# add to list so that in-progress tasks show up
self
.
dequeued
.
append
(
item
)
...
...
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