brett
06/10/2021, 4:25 PMVanessa🦩
06/10/2021, 5:20 PMzifera
06/10/2021, 5:43 PMzifera
06/10/2021, 5:43 PMzifera
06/10/2021, 5:43 PMVanessa🦩
06/10/2021, 5:57 PMzifera
06/10/2021, 5:58 PMWebber
06/10/2021, 6:07 PMVanessa🦩
06/10/2021, 6:23 PMVanessa🦩
06/10/2021, 6:25 PMWebber
06/10/2021, 6:34 PMzifera
06/10/2021, 6:49 PMzifera
06/10/2021, 7:01 PMzifera
06/10/2021, 7:01 PMexport class DurableObject {
constructor(state, env) {
this.state = state;
}
async timeConsumingFunction(url) {
const ref = 'ref-of-storage'
const resp = await fetch(url)
const data = await resp.json()
await this.state.storage.put(ref, JSON.stringify(data))
}
async fetch(request) {
const ref = request.url
let stored = await this.state.storage.get(ref);
let currentPageviews = stored || 0;
currentPageviews++
await this.state.storage.put(ref, currentPageviews);
this.timeConsumingFunction('slowapicall.com?url=' + ref) // in background aka event.waitUntil
return new Response(currentPageviews)
}
}
zifera
06/10/2021, 7:02 PMmatt
06/10/2021, 9:04 PMVanessa🦩
06/11/2021, 1:03 AMsocket.bufferedAmount()
goes up and up and only after a minute or so do I get the 1006.
I know the close frame is unreliable, just like the TCP connection can be interrupted at any time. That is unavoidable - just like arbitrary delays in packets arriving. Our websocket client code handles that.
But. If the server can manage to send a close frame, then it really should, because that informs the client immediately that it should reconnect. We can easily smooth over a 1 second connection loss, but we cannot just reconnect every time there is a 1 second delay in the connection.
I guess you are sending a FIN packet though because sometimes the websocket does close immediately? Although the full websocket closing handshake would be even nicer.
Or, alternatively, some other way to smoothly handle code updates. Our existing system dispatches new sessions to updated instances, but keeps old instances alive until the last connection drops. I can see why you would not want to implement that, but we'd need something.vans163
06/11/2021, 4:53 PMvans163
06/11/2021, 4:54 PMVanessa🦩
06/11/2021, 4:54 PMvans163
06/11/2021, 4:54 PMvans163
06/11/2021, 4:54 PMvans163
06/11/2021, 4:55 PMvans163
06/11/2021, 4:56 PMvans163
06/11/2021, 4:56 PMvans163
06/11/2021, 4:57 PMvans163
06/11/2021, 4:57 PMsteranevdy
06/13/2021, 2:26 AMjed
06/13/2021, 2:11 PM/remind
feature using Durable Objects? ie, letting users enter -- in their own timezone -- multiple arbitrary recurring times at which tasks are run. for example, reminding a user in America/New_York
to eat lunch daily at 13:00.jed
06/13/2021, 2:15 PM