queue-local 0.0.46__tar.gz → 0.0.47__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {queue_local-0.0.46 → queue_local-0.0.47}/PKG-INFO +1 -1
- {queue_local-0.0.46 → queue_local-0.0.47}/queue_local/src/database_queue.py +10 -4
- {queue_local-0.0.46 → queue_local-0.0.47}/queue_local.egg-info/PKG-INFO +1 -1
- {queue_local-0.0.46 → queue_local-0.0.47}/setup.py +1 -1
- {queue_local-0.0.46 → queue_local-0.0.47}/README.md +0 -0
- {queue_local-0.0.46 → queue_local-0.0.47}/pyproject.toml +0 -0
- {queue_local-0.0.46 → queue_local-0.0.47}/queue_local/src/__init__.py +0 -0
- {queue_local-0.0.46 → queue_local-0.0.47}/queue_local/src/our_queue.py +0 -0
- {queue_local-0.0.46 → queue_local-0.0.47}/queue_local.egg-info/SOURCES.txt +0 -0
- {queue_local-0.0.46 → queue_local-0.0.47}/queue_local.egg-info/dependency_links.txt +0 -0
- {queue_local-0.0.46 → queue_local-0.0.47}/queue_local.egg-info/requires.txt +0 -0
- {queue_local-0.0.46 → queue_local-0.0.47}/queue_local.egg-info/top_level.txt +0 -0
- {queue_local-0.0.46 → queue_local-0.0.47}/setup.cfg +0 -0
|
@@ -84,9 +84,14 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
|
|
|
84
84
|
id_column_value = data_json[self.id_column_name]
|
|
85
85
|
del data_json[self.id_column_name]
|
|
86
86
|
self.update_by_id(id_column_value=id_column_value, data_json=data_json)
|
|
87
|
+
# TODO push_result = id_column_value
|
|
87
88
|
return id_column_value
|
|
88
89
|
else:
|
|
90
|
+
# TODO push_result = elf.insert(data_json=data_json)
|
|
89
91
|
return self.insert(data_json=data_json)
|
|
92
|
+
# TODO Can we do this everywhere?
|
|
93
|
+
# TODO logger.end("...", {'push_result': push_result} )
|
|
94
|
+
# TODO return push_result
|
|
90
95
|
|
|
91
96
|
def push_back(self, queue_item: dict) -> None:
|
|
92
97
|
"""Push a taken queue item back to the queue."""
|
|
@@ -105,13 +110,14 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
|
|
|
105
110
|
action_ids = self._fix_action_ids(action_ids)
|
|
106
111
|
|
|
107
112
|
data_json = {"process_id": os.getpid()}
|
|
108
|
-
update_where = f"process_id IS NULL
|
|
109
|
-
f"
|
|
113
|
+
update_where = f"process_id IS NULL " \
|
|
114
|
+
f"AND (queue_status_id IS NULL OR queue_status_id = {QueueStatusEnum.NEW.value}) " \
|
|
115
|
+
f"AND NOW() > start_timestamp AND (end_timestamp is NULL or NOW() < end_timestamp) " + \
|
|
110
116
|
(f"AND action_id IN {action_ids} " if action_ids else "") + \
|
|
111
117
|
(f"AND {custom_condition}" if custom_condition else "")
|
|
112
118
|
self.update_by_where(where=update_where, order_by=self.id_column_name, limit=1, data_json=data_json)
|
|
113
119
|
|
|
114
|
-
select_where = f"process_id = {os.getpid()} AND queue_status_id = {QueueStatusEnum.NEW.value}"
|
|
120
|
+
select_where = f"process_id = {os.getpid()} AND (queue_status_id IS NULL OR queue_status_id = {QueueStatusEnum.NEW.value})"
|
|
115
121
|
queue_item = self.select_one_dict_by_where(where=select_where)
|
|
116
122
|
if queue_item:
|
|
117
123
|
# Update the selected queue item
|
|
@@ -131,7 +137,7 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
|
|
|
131
137
|
def peek(self, action_ids: tuple = ()) -> dict:
|
|
132
138
|
"""Get the first item in the queue without changing it"""
|
|
133
139
|
action_ids = self._fix_action_ids(action_ids)
|
|
134
|
-
where = f"process_id IS NULL AND queue_status_id = {QueueStatusEnum.NEW.value}" + \
|
|
140
|
+
where = f"process_id IS NULL AND (queue_status_id IS NULL OR queue_status_id = {QueueStatusEnum.NEW.value})" + \
|
|
135
141
|
(f" AND action_id IN {action_ids}" if action_ids else "")
|
|
136
142
|
# SELECT * FROM `queue`.`queue_item_view` WHERE process_id IS NULL AND queue_status_id = 0
|
|
137
143
|
# AND action_id IN (1, 2, 3) ORDER BY queue_item_id LIMIT 1
|
|
@@ -5,7 +5,7 @@ package_dir = PACKAGE_NAME.replace("-", "_")
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name=PACKAGE_NAME, # https://pypi.org/project/queue-local
|
|
8
|
-
version='0.0.
|
|
8
|
+
version='0.0.47',
|
|
9
9
|
author="Circles",
|
|
10
10
|
author_email="info@circles.life",
|
|
11
11
|
url=f"https://github.com/circles-zone/{PACKAGE_NAME}-python-package",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|