Exponential retry login

This commit is contained in:
Lizzy Hunt 2023-02-17 14:14:59 -07:00
parent 62feade251
commit 867f8e15db
No known key found for this signature in database
GPG Key ID: 8AC6A4B840C0EC49

View File

@ -5,6 +5,7 @@ import {
KILL_SIGNALS,
REFRESH_JWT_MS,
} from "./constants.js";
import { with_exponential_retry } from "./exponential_retry.js";
import * as actions from "./actions.js";
import * as session from "./session.js";
import * as argparse from "argparse";
@ -86,7 +87,9 @@ specify another socket path with --socket_path`
process.exit(1);
}
await session.login(process.env.A_NUMBER, process.env.PASSWORD);
await with_exponential_retry(() =>
session.login(process.env.A_NUMBER, process.env.PASSWORD)
);
session.refresh_jwt();
setInterval(session.refresh_jwt, REFRESH_JWT_MS);