nebu 0.1.21__py3-none-any.whl → 0.1.22__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.
@@ -260,7 +260,7 @@ except ResponseError as e:
260
260
 
261
261
 
262
262
  # Function to process messages
263
- def process_message(message_id: bytes, message_data: Dict[bytes, bytes]) -> None:
263
+ def process_message(message_id: str, message_data: Dict[str, str]) -> None:
264
264
  # Initialize variables that need to be accessible in the except block
265
265
  return_stream = None
266
266
  user_id = None
@@ -268,14 +268,11 @@ def process_message(message_id: bytes, message_data: Dict[bytes, bytes]) -> None
268
268
  print(f"Message data inner: {message_data}")
269
269
 
270
270
  try:
271
- # Extract the JSON string payload from the b'data' field
272
- # Redis keys/fields might be bytes even with decode_responses=True
273
- payload_str = message_data.get(b"data")
274
-
275
- # decode_responses=True should handle decoding, but Redis can be tricky.
276
- # If errors persist, we might need to re-add explicit decode checks.
277
- if not payload_str or not isinstance(payload_str, str):
278
- # Add a more specific check if needed later based on runtime errors
271
+ # Extract the JSON string payload from the 'data' field
272
+ payload_str = message_data.get("data")
273
+
274
+ # decode_responses=True should mean payload_str is a string if found.
275
+ if not payload_str:
279
276
  raise ValueError(
280
277
  f"Missing or invalid 'data' field (expected string): {message_data}"
281
278
  )
@@ -308,10 +305,10 @@ def process_message(message_id: bytes, message_data: Dict[bytes, bytes]) -> None
308
305
 
309
306
  # --- Health Check Logic based on kind ---
310
307
  if kind == "HealthCheck":
311
- print(f"Received HealthCheck message {message_id.decode('utf-8')}")
308
+ print(f"Received HealthCheck message {message_id}")
312
309
  health_response = {
313
310
  "kind": "StreamResponseMessage", # Respond with a standard message kind
314
- "id": message_id.decode("utf-8"),
311
+ "id": message_id,
315
312
  "content": {"status": "healthy", "checked_message_id": msg_id},
316
313
  "status": "success",
317
314
  "created_at": datetime.now().isoformat(),
@@ -327,7 +324,7 @@ def process_message(message_id: bytes, message_data: Dict[bytes, bytes]) -> None
327
324
  assert isinstance(REDIS_STREAM, str)
328
325
  assert isinstance(REDIS_CONSUMER_GROUP, str)
329
326
  r.xack(REDIS_STREAM, REDIS_CONSUMER_GROUP, message_id)
330
- print(f"Acknowledged HealthCheck message {message_id.decode('utf-8')}")
327
+ print(f"Acknowledged HealthCheck message {message_id}")
331
328
  return # Exit early for health checks
332
329
  # --- End Health Check Logic ---
333
330
 
@@ -413,7 +410,7 @@ def process_message(message_id: bytes, message_data: Dict[bytes, bytes]) -> None
413
410
  # Prepare the response
414
411
  response = {
415
412
  "kind": "StreamResponseMessage",
416
- "id": message_id.decode("utf-8"),
413
+ "id": message_id,
417
414
  "content": result,
418
415
  "status": "success",
419
416
  "created_at": datetime.now().isoformat(),
@@ -427,9 +424,7 @@ def process_message(message_id: bytes, message_data: Dict[bytes, bytes]) -> None
427
424
  # Assert type again closer to usage for type checker clarity
428
425
  assert isinstance(return_stream, str)
429
426
  r.xadd(return_stream, {"data": json.dumps(response)})
430
- print(
431
- f"Processed message {message_id.decode('utf-8')}, result sent to {return_stream}"
432
- )
427
+ print(f"Processed message {message_id}, result sent to {return_stream}")
433
428
 
434
429
  # Acknowledge the message
435
430
  # Assert types again closer to usage for type checker clarity
@@ -438,13 +433,13 @@ def process_message(message_id: bytes, message_data: Dict[bytes, bytes]) -> None
438
433
  r.xack(REDIS_STREAM, REDIS_CONSUMER_GROUP, message_id)
439
434
 
440
435
  except Exception as e:
441
- print(f"Error processing message {message_id.decode('utf-8')}: {e}")
436
+ print(f"Error processing message {message_id}: {e}")
442
437
  traceback.print_exc()
443
438
 
444
439
  # Prepare the error response
445
440
  error_response = {
446
441
  "kind": "StreamResponseMessage",
447
- "id": message_id.decode("utf-8"),
442
+ "id": message_id,
448
443
  "content": {
449
444
  "error": str(e),
450
445
  "traceback": traceback.format_exc(),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nebu
3
- Version: 0.1.21
3
+ Version: 0.1.22
4
4
  Summary: A globally distributed container runtime
5
5
  Requires-Python: >=3.10.14
6
6
  Description-Content-Type: text/markdown
@@ -6,15 +6,15 @@ nebu/containers/container.py,sha256=yb7KaPTVXnEEAlrpdlUi4HNqF6P7z9bmwAILGlq6iqU,
6
6
  nebu/containers/decorator.py,sha256=uFtzlAXRHYZECJ-NPusY7oN9GXvdHrHDd_JNrIGr8aQ,3244
7
7
  nebu/containers/models.py,sha256=0j6NGy4yto-enRDh_4JH_ZTbHrLdSpuMOqNQPnIrwC4,6815
8
8
  nebu/containers/server.py,sha256=yFa2Y9PzBn59E1HftKiv0iapPonli2rbGAiU6r-wwe0,2513
9
- nebu/processors/consumer.py,sha256=47ssdvJU7CGur0JoehNrmNGKwAAzVDVp7UTnphApQlI,20080
9
+ nebu/processors/consumer.py,sha256=qQQWNAZnY7A7Af6SNMYVXN3NOG_9dNK5iE_0us-o2Po,19659
10
10
  nebu/processors/decorate.py,sha256=AeG1c1n8JtcexxAEf2sF2L2eKwVDaNQ5gvPs6EpazKo,34789
11
11
  nebu/processors/default.py,sha256=W4slJenG59rvyTlJ7gRp58eFfXcNOTT2Hfi6zzJAobI,365
12
12
  nebu/processors/models.py,sha256=GvnI8UJrQSjHo2snP07cPfisCH90cEGTY-PZV5_AtXI,3654
13
13
  nebu/processors/processor.py,sha256=oy2YdI-cy6qQWxrZhpZahJV46oWZlu_Im-jm811R_oo,9667
14
14
  nebu/redis/models.py,sha256=coPovAcVXnOU1Xh_fpJL4PO3QctgK9nBe5QYoqEcnxg,1230
15
15
  nebu/services/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- nebu-0.1.21.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
- nebu-0.1.21.dist-info/METADATA,sha256=SmlvWXJgnKLKph_8UCEtgVtLz80EuKrcxRNm3hdEl_8,1678
18
- nebu-0.1.21.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
19
- nebu-0.1.21.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
20
- nebu-0.1.21.dist-info/RECORD,,
16
+ nebu-0.1.22.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
+ nebu-0.1.22.dist-info/METADATA,sha256=5knaeQTz1sBQEH2za1s6-499HYkNfNxLZgxvpRUEO6Y,1678
18
+ nebu-0.1.22.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
19
+ nebu-0.1.22.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
20
+ nebu-0.1.22.dist-info/RECORD,,
File without changes