run cleanupjob on fly (#35)
* clippy+fmt * poor-man's integration of cleanup job - runs every 5 hours - deletes all but 2mn slots * change slots back
This commit is contained in:
parent
7a3480e044
commit
f877a3a0a9
|
@ -22,4 +22,4 @@ COPY --from=build /app/target/release/grpc_banking_transactions_notifications /u
|
||||||
COPY --from=build /app/target/release/cleanupdb /usr/local/bin/
|
COPY --from=build /app/target/release/cleanupdb /usr/local/bin/
|
||||||
COPY --from=build /app/alts.txt /usr/local/bin/
|
COPY --from=build /app/alts.txt /usr/local/bin/
|
||||||
|
|
||||||
CMD grpc_banking_transactions_notifications --rpc-url "$RPC_URL" --grpc-address-to-fetch-blocks "$GEYSER_GRPC_ADDRESS" --grpc-x-token "$GEYSER_GRPC_X_TOKEN" --banking-grpc-addresses "$LIST_OF_BANKING_STAGE_GRPCS" -a /usr/local/bin/alts.txt
|
CMD run-service-and-cleanup.sh
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# bring down whole process tree on exit
|
||||||
|
trap "kill 0" EXIT
|
||||||
|
|
||||||
|
# 432000 = 1 epoch
|
||||||
|
declare -i SLOTS_TO_KEEP=432000*2
|
||||||
|
|
||||||
|
# setup endless loop to run cleanupdb and put it in background
|
||||||
|
while true; do
|
||||||
|
# startup delay
|
||||||
|
sleep 300;
|
||||||
|
# should retain about 1 week of data
|
||||||
|
RUST_LOG=info /usr/local/bin/cleanupdb --num-slots-to-keep $SLOTS_TO_KEEP;
|
||||||
|
# every 5 hours
|
||||||
|
sleep 18000;
|
||||||
|
done &
|
||||||
|
|
||||||
|
/usr/local/bin/grpc_banking_transactions_notifications --rpc-url "$RPC_URL" --grpc-address-to-fetch-blocks "$GEYSER_GRPC_ADDRESS" --grpc-x-token "$GEYSER_GRPC_X_TOKEN" --banking-grpc-addresses "$LIST_OF_BANKING_STAGE_GRPCS" -a /usr/local/bin/alts.txt
|
Loading…
Reference in New Issue