MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / isServerAvailable

Function isServerAvailable

ui/media/js/engine.js:277–295  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

275 }
276
277 function isServerAvailable() {
278 if (typeof serverState !== "object") {
279 console.error("serverState not set to a value. Connection to server could be lost...")
280 return false
281 }
282 if (Date.now() >= serverState.time + SERVER_STATE_VALIDITY_DURATION) {
283 console.warn("SERVER_STATE_VALIDITY_DURATION elapsed. Connection to server could be lost...")
284 return false
285 }
286 switch (serverState.status) {
287 case ServerStates.loadingModel:
288 case ServerStates.rendering:
289 case ServerStates.online:
290 return true
291 default:
292 console.warn("Unexpected server status. Server could be unavailable... Status: %s", serverState.status)
293 return false
294 }
295 }
296
297 async function waitUntil(isReadyFn, delay, timeout) {
298 if (typeof delay === "number") {

Callers 3

healthCheckFunction · 0.85
waitUntilFunction · 0.85
engine.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected