This file contains hidden or 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
| import DataLoader from 'dataloader' | |
| import { Exchange, Operation } from 'urql' | |
| import { pipe, map } from 'wonka' | |
| interface BatchRequest { | |
| url: string | |
| options?: RequestInit | |
| } | |
| const batchFetch = ( |
This file contains hidden or 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
| // Javascript. | |
| const one = async () => { | |
| // Simulate a workload. | |
| sleep(Math.floor(Math.random() * Math.floor(2000))) | |
| return 1 | |
| } | |
| const two = async () => { | |
| // Simulate a workload. |
This file contains hidden or 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 is just sync relevant snippet from the DO integration as it's heavily customised otherwise | |
| const synchronizer = createCustomSynchronizer( | |
| this.store, | |
| (targetActorId, requestId, message, body) => | |
| createMessages(targetActorId, requestId, message, body).map((message) => | |
| this.handleMessage(SERVER_ACTOR_ID, message), | |
| ), | |
| (receive: Receive) => { | |
| this.forwardToServerActor = async (message: string) => { |
OlderNewer