Skip to content

Commit f9a080c

Browse files
committed
Update to drift correction once a day
1 parent ea7e12b commit f9a080c

1 file changed

Lines changed: 1 addition & 22 deletions

File tree

scripts/aws/entrypoint.sh

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ echo "Starting vsock proxy..."
2323
/app/vsockpx --config /app/proxies.nitro.yaml --daemon --workers $(( ( $(nproc) + 3 ) / 4 )) --log-level 3
2424

2525
TIME_SYNC_URL="http://127.0.0.1:27015/getCurrentTime"
26-
TIME_SYNC_INTERVAL_SECONDS="${TIME_SYNC_INTERVAL_SECONDS:-300}"
26+
TIME_SYNC_INTERVAL_SECONDS="${TIME_SYNC_INTERVAL_SECONDS:-86400}"
2727
TIME_SYNC_OFFSET_SECONDS="${TIME_SYNC_OFFSET_SECONDS:-30}"
2828

2929
sync_enclave_time() {
@@ -49,27 +49,6 @@ sync_enclave_time() {
4949
fi
5050
}
5151

52-
sync_enclave_time_with_offset_once() {
53-
local current_time
54-
local parent_epoch
55-
if current_time=$(curl -s -f -x socks5h://127.0.0.1:3305 "${TIME_SYNC_URL}"); then
56-
parent_epoch=$(date -u -d "${current_time}" +%s 2>/dev/null || true)
57-
if [[ -n "${parent_epoch}" ]]; then
58-
parent_epoch=$((parent_epoch + TIME_SYNC_OFFSET_SECONDS))
59-
if ! date -u -s "@${parent_epoch}"; then
60-
echo "Time sync: failed to set enclave time from '${current_time}' with offset ${TIME_SYNC_OFFSET_SECONDS}s"
61-
return 1
62-
fi
63-
echo "Time sync: updated enclave time to ${current_time} + ${TIME_SYNC_OFFSET_SECONDS}s"
64-
fi
65-
else
66-
echo "Time sync: failed to fetch time from parent instance"
67-
return 1
68-
fi
69-
}
70-
71-
sync_enclave_time_with_offset_once || true
72-
7352
start_time_sync_loop() {
7453
while true; do
7554
sleep "${TIME_SYNC_INTERVAL_SECONDS}"

0 commit comments

Comments
 (0)