queue-local 0.0.46__tar.gz → 0.0.48__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.48}/PKG-INFO +1 -1
- {queue_local-0.0.46 → queue_local-0.0.48}/queue_local/src/database_queue.py +12 -4
- {queue_local-0.0.46 → queue_local-0.0.48}/queue_local.egg-info/PKG-INFO +1 -1
- {queue_local-0.0.46 → queue_local-0.0.48}/setup.py +1 -1
- {queue_local-0.0.46 → queue_local-0.0.48}/README.md +0 -0
- {queue_local-0.0.46 → queue_local-0.0.48}/pyproject.toml +0 -0
- {queue_local-0.0.46 → queue_local-0.0.48}/queue_local/src/__init__.py +0 -0
- {queue_local-0.0.46 → queue_local-0.0.48}/queue_local/src/our_queue.py +0 -0
- {queue_local-0.0.46 → queue_local-0.0.48}/queue_local.egg-info/SOURCES.txt +0 -0
- {queue_local-0.0.46 → queue_local-0.0.48}/queue_local.egg-info/dependency_links.txt +0 -0
- {queue_local-0.0.46 → queue_local-0.0.48}/queue_local.egg-info/requires.txt +0 -0
- {queue_local-0.0.46 → queue_local-0.0.48}/queue_local.egg-info/top_level.txt +0 -0
- {queue_local-0.0.46 → queue_local-0.0.48}/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,15 @@ 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
|
-
|
|
120
|
+
# TODO In which cases queue_status_id IS NULL? - Does it indicate a problem/bug?
|
|
121
|
+
select_where = f"process_id = {os.getpid()} AND (queue_status_id IS NULL OR queue_status_id = {QueueStatusEnum.NEW.value})"
|
|
115
122
|
queue_item = self.select_one_dict_by_where(where=select_where)
|
|
116
123
|
if queue_item:
|
|
117
124
|
# Update the selected queue item
|
|
@@ -131,7 +138,8 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
|
|
|
131
138
|
def peek(self, action_ids: tuple = ()) -> dict:
|
|
132
139
|
"""Get the first item in the queue without changing it"""
|
|
133
140
|
action_ids = self._fix_action_ids(action_ids)
|
|
134
|
-
|
|
141
|
+
# TODO In which cases queue_status_id IS NULL? - Does it indicate a problem/bug?
|
|
142
|
+
where = f"process_id IS NULL AND (queue_status_id IS NULL OR queue_status_id = {QueueStatusEnum.NEW.value})" + \
|
|
135
143
|
(f" AND action_id IN {action_ids}" if action_ids else "")
|
|
136
144
|
# SELECT * FROM `queue`.`queue_item_view` WHERE process_id IS NULL AND queue_status_id = 0
|
|
137
145
|
# 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.48',
|
|
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
|