queue-local 0.0.28__tar.gz → 0.0.29__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: queue-local
3
- Version: 0.0.28
3
+ Version: 0.0.29
4
4
  Home-page: https://github.com/circles-zone/queue-local-python-package
5
5
  Author: Circles
6
6
  Author-email: info@circles.life
@@ -11,6 +11,7 @@ from logger_local.LoggerComponentEnum import LoggerComponentEnum
11
11
  from user_context_remote.user_context import UserContext
12
12
 
13
13
  from .our_queue import OurQueue
14
+ from .utils import get_thread_id, get_ipv6, get_ipv4
14
15
 
15
16
  QUEUE_LOCAL_PYTHON_COMPONENT_ID = 155
16
17
  QUEUE_LOCAL_PYTHON_COMPONENT_NAME = "queue_local/src/database_queue.py"
@@ -101,10 +102,11 @@ class DatabaseQueue(OurQueue, GenericCRUD):
101
102
  if queue_item:
102
103
  # Update the selected queue item
103
104
  query = f"UPDATE {self.default_table_name} " \
104
- f"SET queue_status_id = %s, updated_user_id = %s, user_jwt=%s, start_timestamp = NOW() " \
105
+ f"SET queue_status_id=%s, updated_user_id=%s, user_jwt=%s, thread_id=%s," \
106
+ f"server_ip_v4=%s, server_ip_v6=%s, start_timestamp = NOW() " \
105
107
  f"WHERE {self.id_column_name} = %s"
106
108
  params = (StatusEnum.RETRIEVED.value, updated_user_id, self.user.get_user_JWT(),
107
- queue_item[self.id_column_name])
109
+ get_thread_id(), get_ipv4(), get_ipv6(), queue_item[self.id_column_name])
108
110
  self.cursor.execute(query, params)
109
111
  self.logger.end("Entry retrieved and updated from the queue database successfully",
110
112
  object={k: str(v) for k, v in queue_item.items()}) # contains a datetime object
@@ -0,0 +1,39 @@
1
+ import socket
2
+ import threading
3
+
4
+
5
+ def get_ipv4():
6
+ # Get the local machine's IPv4 and IPv6 addresses
7
+ try:
8
+ ipv4_address = socket.gethostbyname(socket.gethostname())
9
+ except Exception as e:
10
+ ipv4_address = None
11
+ print("Error getting IPv4 address " + str(e))
12
+ return ipv4_address
13
+
14
+
15
+ def get_ipv6():
16
+ try:
17
+ ipv6_address = socket.getaddrinfo(socket.gethostname(), None, socket.AF_INET6)[0][4][0]
18
+ except Exception as e:
19
+ ipv6_address = None
20
+ print("Error getting IPv6 address " + str(e))
21
+ return ipv6_address
22
+
23
+
24
+ def get_thread_id():
25
+ # Get the current thread ID
26
+ return threading.current_thread().ident
27
+
28
+
29
+ # Example usage
30
+ if __name__ == "__main__":
31
+ # Get and print the IPv4 and IPv6 addresses
32
+ ipv4_address = get_ipv4()
33
+ ipv6_address = get_ipv6()
34
+ print(f"IPv4 Address: {ipv4_address}")
35
+ print(f"IPv6 Address: {ipv6_address}")
36
+
37
+ # Get and print the thread ID
38
+ thread_id = get_thread_id()
39
+ print(f"Thread ID: {thread_id}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: queue-local
3
- Version: 0.0.28
3
+ Version: 0.0.29
4
4
  Home-page: https://github.com/circles-zone/queue-local-python-package
5
5
  Author: Circles
6
6
  Author-email: info@circles.life
@@ -8,4 +8,5 @@ queue_local.egg-info/requires.txt
8
8
  queue_local.egg-info/top_level.txt
9
9
  queue_local/src/__init__.py
10
10
  queue_local/src/database_queue.py
11
- queue_local/src/our_queue.py
11
+ queue_local/src/our_queue.py
12
+ queue_local/src/utils.py
@@ -8,7 +8,7 @@ with open('README.md') as f:
8
8
 
9
9
  setuptools.setup(
10
10
  name=PACKAGE_NAME, # https://pypi.org/project/queue-local
11
- version='0.0.28',
11
+ version='0.0.29',
12
12
  author="Circles",
13
13
  author_email="info@circles.life",
14
14
  url=f"https://github.com/circles-zone/{PACKAGE_NAME}-python-package",
File without changes
File without changes