dsmq 1.2.0__py3-none-any.whl → 1.2.1__py3-none-any.whl
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.
dsmq/server.py
CHANGED
@@ -19,7 +19,7 @@ _db_name = "file::memory:?cache=shared"
|
|
19
19
|
dsmq_server = None
|
20
20
|
|
21
21
|
|
22
|
-
def serve(host=_default_host, port=_default_port):
|
22
|
+
def serve(host=_default_host, port=_default_port, verbose=False):
|
23
23
|
"""
|
24
24
|
For best results, start this running in its own process and walk away.
|
25
25
|
"""
|
@@ -53,9 +53,10 @@ CREATE TABLE IF NOT EXISTS messages (timestamp DOUBLE, topic TEXT, message TEXT)
|
|
53
53
|
# dsmq_server = ws_serve(request_handler, host, port)
|
54
54
|
with ws_serve(request_handler, host, port) as dsmq_server:
|
55
55
|
dsmq_server.serve_forever()
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
if verbose:
|
57
|
+
print()
|
58
|
+
print(f"Server started at {host} on port {port}.")
|
59
|
+
print("Waiting for clients...")
|
59
60
|
|
60
61
|
sqlite_conn.close()
|
61
62
|
|
@@ -141,7 +142,6 @@ AND timestamp = a.min_time
|
|
141
142
|
elif msg["action"] == "shutdown":
|
142
143
|
# Run this from a separate thread to prevent deadlock
|
143
144
|
global dsmq_server
|
144
|
-
print("Shutting down the dsmq server.")
|
145
145
|
|
146
146
|
def shutdown_gracefully(server_to_shutdown):
|
147
147
|
server_to_shutdown.shutdown()
|
@@ -157,7 +157,9 @@ AND timestamp = a.min_time
|
|
157
157
|
Thread(target=shutdown_gracefully, args=(dsmq_server,)).start()
|
158
158
|
break
|
159
159
|
else:
|
160
|
-
|
160
|
+
raise RuntimeWarning(
|
161
|
+
"dsmq client action must either be 'put', 'get', or 'shutdown'"
|
162
|
+
)
|
161
163
|
|
162
164
|
# Periodically clean out messages from the queue that are
|
163
165
|
# past their sell buy date.
|
@@ -3,10 +3,10 @@ dsmq/client.py,sha256=2i3BhpQM71j-uZlqiJvzQgywi1y07K1VgQe8i2Koi0g,2070
|
|
3
3
|
dsmq/demo.py,sha256=K53cC5kN7K4kNJlPq7c5OTIMHRCKTo9hYX2aIos57rU,542
|
4
4
|
dsmq/example_get_client.py,sha256=PvAsDGEAH1kVBifLVg2rx8ZxnAZmvzVCvZq13VgpLds,301
|
5
5
|
dsmq/example_put_client.py,sha256=QxDc3i7KAjjhpwxRRpI0Ke5KTNSPuBf9kkcGyTvUEaw,353
|
6
|
-
dsmq/server.py,sha256=
|
6
|
+
dsmq/server.py,sha256=kCqBzgikvJlCgAfLHd18LS7fmkYW6e0RhmdwqdeXJ7Q,6079
|
7
7
|
dsmq/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
dsmq/tests/integration_test.py,sha256=lC97LAzdQixv75OwjqjKTvYnSZpsP0zuzFP8ocUnjl8,6031
|
9
|
-
dsmq-1.2.
|
10
|
-
dsmq-1.2.
|
11
|
-
dsmq-1.2.
|
12
|
-
dsmq-1.2.
|
9
|
+
dsmq-1.2.1.dist-info/METADATA,sha256=6DSNtpbtnGbwQ5nGM0_tX1lQaxP7VWFmcBH8mU-RAN0,4730
|
10
|
+
dsmq-1.2.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
11
|
+
dsmq-1.2.1.dist-info/licenses/LICENSE,sha256=3Yu1mAp5VsKmnDtzkiOY7BdmrLeNwwZ3t6iWaLnlL0Y,1071
|
12
|
+
dsmq-1.2.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|