Skip to content

Commit

Permalink
Delay bind daemon (#1824)
Browse files Browse the repository at this point in the history
* silence bind daemon

* add daemon delay
  • Loading branch information
pablomendezroyo authored Jan 31, 2024
1 parent 6595209 commit d1d145d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion packages/daemons/src/bind/ensureBindContainerIpAndRunning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export async function ensureBindContainerIpAndRunning(): Promise<void> {
.NetworkSettings.Networks[params.DOCKER_PRIVATE_NETWORK_NAME]
.IPAddress === params.BIND_IP;
if (hasRightIp) {
logs.info(`${params.bindContainerName} container has right IP`);
// logs.info(`${params.bindContainerName} container has right IP`);
return;
} else {
logs.info(`${params.bindContainerName} container has wrong IP`);
await disconnectConflictingContainerAndStartBind();
Expand Down
3 changes: 2 additions & 1 deletion packages/daemons/src/bind/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export function startBindDaemon(signal: AbortSignal): void {
runAtMostEvery(
async () => ensureBindNetworkConfig(),
params.BIND_DAEMON_INTERVAL,
signal
signal,
1000 * 10 // initial delay
);
}
17 changes: 8 additions & 9 deletions packages/migrations/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,14 @@ export async function executeMigrations(): Promise<void> {
})
);

await addDappnodePeerToLocalIpfsNode().catch(
(e: { message: any; stack: any }) =>
migrationErrors.push({
migration: "add Dappnode peer to local IPFS node",
coreVersion: "0.2.88",
name: "MIGRATION_ERROR",
message: e.message,
stack: e.stack,
})
await addDappnodePeerToLocalIpfsNode().catch((e) =>
migrationErrors.push({
migration: "add Dappnode peer to local IPFS node",
coreVersion: "0.2.88",
name: "MIGRATION_ERROR",
message: e.message,
stack: e.stack,
})
);

if (migrationErrors.length > 0) throw migrationErrors;
Expand Down
4 changes: 3 additions & 1 deletion packages/utils/src/asyncFlows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ interface MemoizeDebouncedFunction<F extends AnyFunction>
export async function runAtMostEvery(
fn: () => Promise<void>,
intervalMs: number,
signal: AbortSignal
signal: AbortSignal,
initialDelayMs?: number
): Promise<void> {
if (initialDelayMs) await sleep(initialDelayMs, signal);
runAtMostEveryIntervals(fn, [intervalMs], signal);
}

Expand Down

0 comments on commit d1d145d

Please sign in to comment.