-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
try fix premature shutdown if startup takes too long
- Loading branch information
Showing
4 changed files
with
30 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from "https://deno.land/x/embassyd_sdk@v0.3.3.0.11/mod.ts"; | ||
export * from "https://deno.land/x/embassyd_sdk@v0.3.3.0.11/util.ts"; | ||
export * from "https://deno.land/x/embassyd_sdk@v0.3.3.0.11/healthUtil.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,20 @@ | ||
import { healthUtil, types as T } from "../deps.ts"; | ||
import { error, guardDurationAboveMinimum, ok, types as T } from "../deps.ts"; | ||
|
||
const url = "http://labelbase.embassy:8080"; | ||
|
||
export const health: T.ExpectedExports.health = { | ||
"app-ui": healthUtil.checkWebUrl("http://labelbase.embassy:8080"), | ||
async "app-ui"(effects, duration) { | ||
// Ensure the starting duration is past a minimum | ||
const value = guardDurationAboveMinimum({ duration, minimumTime: 60_000 }); | ||
if (value) { | ||
return value; | ||
} | ||
try { | ||
await effects.fetch(url); | ||
return ok; | ||
} catch (e) { | ||
console.warn(e); | ||
return error("Can not reach Labelbase"); | ||
} | ||
}, | ||
}; |