mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-04-14 06:26:35 +00:00
Decoupled checking VPN status from notify callback
Signed-off-by: Miguel Casqueira <miguel@balena.io>
This commit is contained in:
parent
a361e44b14
commit
402a85cf2b
@ -42,13 +42,17 @@ export function enableCheck(enable: boolean) {
|
||||
isConnectivityCheckEnabled = enable;
|
||||
}
|
||||
|
||||
async function vpnStatusInotifyCallback(): Promise<void> {
|
||||
export async function isVPNActive(): Promise<boolean> {
|
||||
try {
|
||||
await fs.lstat(`${constants.vpnStatusPath}/active`);
|
||||
isConnectivityCheckPaused = true;
|
||||
} catch {
|
||||
isConnectivityCheckPaused = false;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
async function vpnStatusInotifyCallback(): Promise<void> {
|
||||
isConnectivityCheckPaused = await isVPNActive();
|
||||
}
|
||||
|
||||
export const startConnectivityCheck = _.once(
|
||||
|
Loading…
x
Reference in New Issue
Block a user