Skip to content

Commit 3c14bde

Browse files
committed
Added sleep on worker thread in order to optimize the CPU consumption, new version 1.0.3
1 parent 7fdbdbf commit 3c14bde

File tree

7 files changed

+10
-3
lines changed

7 files changed

+10
-3
lines changed

django-queue-manager/MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
include LICENSE
2-
include README.rst
2+
include README.md
26.3 KB
Binary file not shown.
26.3 KB
Binary file not shown.

django-queue-manager/django_queue_manager.egg-info/PKG-INFO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 1.1
22
Name: django-queue-manager
3-
Version: 1.0.1
3+
Version: 1.0.3
44
Summary: A simple app that provides a Message Queue System using a socket as broker, this app, make you able to manage an ordered queue of tasks (with calling a simple queuing function form API).Simple to setup, easy to manage and scalable, the queue can be remotized to another server,you can use multiple istance of the application, and easly manage multiple broker and relatives queues.This app, will integrate into your DB backend and serves three table with the states of the queue.
55
Home-page: http://www.fardellasimone.com/
66
Author: Fardella Simone

django-queue-manager/django_queue_manager.egg-info/SOURCES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
LICENSE
22
MANIFEST.in
3+
README.md
34
setup.py
45
django_queue_manager/API.py
56
django_queue_manager/__init__.py

django-queue-manager/django_queue_manager/worker.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import threading
44
import queue as Queue
55
import uuid
6+
7+
import time
68
from django_queue_manager.task_manager import TaskManager
79

810
logging.basicConfig(level=logging.DEBUG, format='[%(levelname)s] (%(threadName)-10s) %(message)s', )
@@ -98,5 +100,9 @@ def run(self):
98100
name=task.task_function_name,
99101
db_id=task.db_id))
100102

103+
else:
104+
#In order to respect the CPU sleeps for 5 milliseconds when the queue it's empty
105+
time.sleep(0.005)
106+
101107
self.worker_queue = None
102108
self.logger.warning('Worker stopped, {0} tasks handled'.format(self.tasks_counter))

django-queue-manager/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
setup(
1111
name='django-queue-manager',
12-
version='1.0.1',
12+
version='1.0.3',
1313
packages=find_packages(),
1414
include_package_data=True,
1515
license='GNU GPLv3',

0 commit comments

Comments
 (0)