-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add vercel analytics code - add code for future optimistic updates
- Loading branch information
1 parent
39d07e7
commit ad5bd3e
Showing
13 changed files
with
103 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
# Path to your docker-compose.yml file | ||
COMPOSE_PATH="sepolia-compose.yaml" | ||
|
||
# Container names (as specified in docker-compose.yml) | ||
CONTAINER_NAMES=("indexer-adventurers_indexer-1" "indexer-battles_indexer-1" "indexer-beasts_indexer-1" "indexer-discoveries_indexer-1" "indexer-items_indexer-1" "indexer-scores_indexer-1") | ||
|
||
# Time to wait between checks (5mins / 300 seconds) | ||
INTERVAL=300 | ||
|
||
# Check if a block has been processed in the last minute | ||
check_container_activity() { | ||
local CONTAINER_NAME="$1" | ||
LAST_LOG=$(docker logs "$CONTAINER_NAME" 2>&1 | tail -1) # Assuming you want the last log entry | ||
echo "Extracted log: $LAST_LOG" # Print timestamp for verification | ||
LAST_TIMESTAMP=$(echo "$LAST_LOG" | sed -E 's/\x1B\[[0-9;]*[JKmsu]//g' | cut -d' ' -f1) | ||
|
||
echo "Extracted timestamp: $LAST_TIMESTAMP" # Print timestamp for verification | ||
|
||
# Convert timestamp to epoch (seconds since 1970) | ||
LAST_EPOCH=$(date -d "$LAST_TIMESTAMP" +%s) | ||
CURRENT_EPOCH=$(date +%s) | ||
echo "Current time difference: $((CURRENT_EPOCH - LAST_EPOCH)) seconds" | ||
|
||
# If the difference is more than the interval, return 1 (unhealthy) | ||
if (( CURRENT_EPOCH - LAST_EPOCH > INTERVAL )); then | ||
return 1 | ||
else | ||
return 0 | ||
fi | ||
} | ||
|
||
while true; do | ||
for CONTAINER_NAME in "${CONTAINER_NAMES[@]}"; do | ||
if ! check_container_activity "$CONTAINER_NAME"; then | ||
echo "Container $CONTAINER_NAME seems to be stuck. Restarting..." | ||
docker-compose -f $COMPOSE_PATH stop "$CONTAINER_NAME" | ||
docker-compose -f $COMPOSE_PATH up -d "$CONTAINER_NAME" | ||
# # Add a notification mechanism here if needed | ||
fi | ||
done | ||
sleep $INTERVAL | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1886,6 +1886,13 @@ | |
"@typescript-eslint/types" "5.59.2" | ||
eslint-visitor-keys "^3.3.0" | ||
|
||
"@vercel/analytics@^1.2.2": | ||
version "1.2.2" | ||
resolved "https://registry.yarnpkg.com/@vercel/analytics/-/analytics-1.2.2.tgz#715d8f203a170c06ba36b363e03b048c03060d5d" | ||
integrity sha512-X0rctVWkQV1e5Y300ehVNqpOfSOufo7ieA5PIdna8yX/U7Vjz0GFsGf4qvAhxV02uQ2CVt7GYcrFfddXXK2Y4A== | ||
dependencies: | ||
server-only "^0.0.1" | ||
|
||
"@walletconnect/[email protected]": | ||
version "2.12.2" | ||
resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-2.12.2.tgz#12bd568b90daed876e58ebcc098c12843a3321e6" | ||
|
@@ -5125,6 +5132,11 @@ semver@^7.3.7: | |
dependencies: | ||
lru-cache "^6.0.0" | ||
|
||
server-only@^0.0.1: | ||
version "0.0.1" | ||
resolved "https://registry.yarnpkg.com/server-only/-/server-only-0.0.1.tgz#0f366bb6afb618c37c9255a314535dc412cd1c9e" | ||
integrity sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA== | ||
|
||
set-cookie-parser@^2.4.8: | ||
version "2.6.0" | ||
resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz#131921e50f62ff1a66a461d7d62d7b21d5d15a51" | ||
|