Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/recover_ib_gateway_ready.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ compose_service_name="${IB_GATEWAY_COMPOSE_SERVICE_NAME:-ib-gateway}"
gateway_mode="${1:-${IB_GATEWAY_MODE:-paper}}"
initial_wait_seconds="${IB_GATEWAY_RECOVERY_INITIAL_WAIT_SECONDS:-240}"
restart_wait_seconds="${IB_GATEWAY_RECOVERY_RESTART_WAIT_SECONDS:-300}"
recreate_wait_seconds="${IB_GATEWAY_RECOVERY_RECREATE_WAIT_SECONDS:-360}"
recreate_wait_seconds="${IB_GATEWAY_RECOVERY_RECREATE_WAIT_SECONDS:-600}"
lock_file="${IB_GATEWAY_RECOVERY_LOCK_FILE:-/var/lock/ib_gateway_recovery.lock}"
lock_wait_seconds="${IB_GATEWAY_RECOVERY_LOCK_WAIT_SECONDS:-900}"

Expand Down
8 changes: 7 additions & 1 deletion scripts/wait_for_ib_gateway_ready.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ if IB is not None:
ib = IB()
try:
try:
ib.connect(host, port, clientId=client_id, timeout=timeout_seconds)
ib.connect(
host,
port,
clientId=client_id,
timeout=timeout_seconds,
readonly=True,
)
accounts = ib.managedAccounts()
if not accounts:
raise RuntimeError("IB API healthcheck did not receive managed accounts")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_gateway_recovery_scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test -x "$unit_helper_script"

grep -Fq 'IB_GATEWAY_RECOVERY_INITIAL_WAIT_SECONDS:-240' "$recover_script"
grep -Fq 'IB_GATEWAY_RECOVERY_RESTART_WAIT_SECONDS:-300' "$recover_script"
grep -Fq 'IB_GATEWAY_RECOVERY_RECREATE_WAIT_SECONDS:-360' "$recover_script"
grep -Fq 'IB_GATEWAY_RECOVERY_RECREATE_WAIT_SECONDS:-600' "$recover_script"
grep -Fq 'IB_GATEWAY_RECOVERY_LOCK_FILE:-/var/lock/ib_gateway_recovery.lock' "$recover_script"
grep -Fq 'IB_GATEWAY_RECOVERY_LOCK_WAIT_SECONDS:-900' "$recover_script"
grep -Fq 'flock -n 9' "$recover_script"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_wait_for_ib_gateway_ready.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ grep -Fq "docker inspect --format '{{.State.Running}}'" "$script_file"
grep -Fq 'IB_GATEWAY_HEALTHCHECK_CLIENT_ID:-$((9000 + (BASHPID % 9000)))' "$script_file"
grep -Fq 'check_api_handshake()' "$script_file"
grep -Fq 'from ib_insync import IB' "$script_file"
grep -Fq 'ib.connect(host, port, clientId=client_id, timeout=timeout_seconds)' "$script_file"
grep -Fq 'readonly=True' "$script_file"
grep -Fq 'IB API ib_insync healthcheck ready' "$script_file"
grep -Fq 'b"API\0" + struct.pack(">I", len(b"v157..176")) + b"v157..176"' "$script_file"
grep -Fq 'has_next_valid_id and has_managed_accounts' "$script_file"
Expand Down