Skip to content

Commit

Permalink
dev(auth): lower token refresh interval in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
theborakompanioni committed Sep 26, 2023
1 parent c8a167e commit f4811da
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/context/WalletContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import * as Api from '../libs/JmWalletApi'

import { WalletBalanceSummary, toBalanceSummary } from './BalanceSummary'
import { JM_API_AUTH_TOKEN_EXPIRY } from '../constants/config'
import { isDevMode } from '../constants/debugFeatures'

const API_AUTH_TOKEN_RENEW_INTERVAL: Milliseconds = isDevMode()
? 60 * 1_000
: Math.round(JM_API_AUTH_TOKEN_EXPIRY * 0.75)

export interface CurrentWallet {
name: Api.WalletName
Expand Down Expand Up @@ -337,7 +342,7 @@ const WalletProvider = ({ children }: PropsWithChildren<any>) => {
.catch((err) => console.error(err))
}

const interval = setInterval(renewToken, JM_API_AUTH_TOKEN_EXPIRY / 3)
const interval = setInterval(renewToken, API_AUTH_TOKEN_RENEW_INTERVAL)
return () => {
clearInterval(interval)
abortCtrl.abort()
Expand Down

0 comments on commit f4811da

Please sign in to comment.