Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
break;
case PROVISIONING:
// Wait for the provisioning server to get up
while (original.type !== UP) {
await sleep(1000);
// NOTE: Could do coordination here by recording timestamps in the PROVISIONING type
// At the very least there should come a point we time out at
original = this.get(binderOpts);
}
if (original && original.type === UP) {
return original.config;
}
}
const host = await binder(binderOpts)
.pipe(
tap(x => {
// Log binder messages to the console for debuggability
console.log("%c BINDER MESSAGE", "color: rgb(87, 154, 202)");
console.log(x);
}),
filter(msg => msg.phase === "ready"),
map(msg => makeHost({ endpoint: msg.url, token: msg.token }))
)
.toPromise();
if (
!host.config ||
!host.config.endpoint ||
!host.config.token ||
!host.config.crossDomain
switchMap(({ payload: { serverId, oldServerId, repo, gitref } }) => {
return binder({ repo, gitref }, EventSource).pipe(
mergeMap(message => {
const actionsArray = [
actions.addServerMessage({ serverId, message })
];
if (message.phase === "ready") {
const config = {
endpoint: message.url.replace(/\/\s*$/, ""),
uri: "/",
token: message.token,
crossDomain: true
};
actionsArray.push(
actions.activateServerFulfilled({ serverId, config })
);
actionsArray.push(actions.fetchKernelSpecs({ serverId }));
if (oldServerId) {