-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
51 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ export type { | |
} from "https://deno.land/x/[email protected]/mod.ts"; | ||
export { | ||
action, | ||
call, | ||
createChannel, | ||
createContext, | ||
createQueue, | ||
|
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
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,12 +1,12 @@ | ||
import { expect, useAbortSignal } from "../deps.ts"; | ||
import { call, useAbortSignal } from "../deps.ts"; | ||
|
||
export function* request(url: string | URL | Request, opts?: RequestInit) { | ||
const signal = yield* useAbortSignal(); | ||
const response = yield* expect(fetch(url, { signal, ...opts })); | ||
const response = yield* call(fetch(url, { signal, ...opts })); | ||
return response; | ||
} | ||
|
||
export function* json(response: Response) { | ||
const result = yield* expect(response.json()); | ||
const result = yield* call(response.json()); | ||
return result; | ||
} |
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,17 +1,16 @@ | ||
import type { OpFn } from "../types.ts"; | ||
|
||
import type { Operator } from "../types.ts"; | ||
import { safe } from "./call.ts"; | ||
import { parallel } from "./parallel.ts"; | ||
|
||
export function supervise<T>(op: OpFn<T>) { | ||
export function supervise<T>(op: Operator<T>) { | ||
return function* () { | ||
while (true) { | ||
yield* safe(op); | ||
} | ||
}; | ||
} | ||
|
||
export function* keepAlive(ops: OpFn[]) { | ||
export function* keepAlive(ops: Operator<unknown>[]) { | ||
const results = yield* parallel(ops.map(supervise)); | ||
return yield* results; | ||
} |
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
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