fix: fixed logic in data subscription to redis

This commit is contained in:
2023-08-09 21:40:21 +02:00
parent b88346182e
commit 37705f76b0
2 changed files with 13 additions and 5 deletions

View File

@@ -65,7 +65,7 @@ def send_data(data, q, norm_sum, bec_producer, metadata, proj_nr) -> None:
return_dict = {"data": data[line, ...]}
msg = BECMessage.DeviceMessage(signals=return_dict).dumps()
print(f"Sending line {line}")
bec_producer.lpush(topic=f"px_stream/projection_{proj_nr}/data", msgs=msg)
bec_producer.rpush(topic=f"px_stream/projection_{proj_nr}/data", msgs=msg)
print(f"Time to send {time.time()-start} seconds")
print(f"Rate {data.shape[0]/(time.time()-start)} Hz")
print(f"Data volume {data.nbytes/1e6} MB")
@@ -77,6 +77,6 @@ if __name__ == "__main__":
proj_nr = 180
while True:
send_data(data, q, norm_sum, bec_producer, metadata, proj_nr=proj_nr)
time.sleep(30)
time.sleep(50)
bec_producer.delete(topic=f"px_stream/projection_{proj_nr}/data:val")
# proj_nr = proj_nr + 1