sathoro
04/25/2023, 3:04 AMUnsmart | Tech debt
04/25/2023, 3:16 AMsathoro
04/25/2023, 3:36 AMErwin
04/25/2023, 12:34 PMsathoro
04/25/2023, 1:46 PMuser6251
04/25/2023, 3:51 PMUnsmart | Tech debt
04/25/2023, 3:53 PMUnsmart | Tech debt
04/25/2023, 3:58 PMdeleteAll
on workerd source:
https://github.com/cloudflare/workerd/blob/main/src/workerd/api/actor-state.c%2B%2B#L498user6251
04/25/2023, 3:58 PMjohn.spurlock
04/25/2023, 4:43 PMPlotzes
04/26/2023, 12:05 AM!remindme ...
command for a discord bot then ideally i would set a durable object alarm to the specified time but then when the alarm goes off how would i get the message that the user specified? How would you know what the message was for this specific alarm?Plotzes
04/26/2023, 12:07 AMkian
04/26/2023, 12:08 AMPlotzes
04/26/2023, 12:10 AMPlotzes
04/26/2023, 12:10 AMPlotzes
04/26/2023, 12:10 AMVlady
04/26/2023, 12:12 AMIn order to use Durable Objects, you must agree to pricing at https://dash.cloudflare.com/***/workers/overview?enable-durable-objects
Unsmart | Tech debt
04/26/2023, 12:13 AMVlady
04/26/2023, 12:14 AMUnsmart | Tech debt
04/26/2023, 12:14 AMVlady
04/26/2023, 12:51 AMErwin
04/26/2023, 12:59 AMlist
, not get
to get the context from storage. And then at the end of the alarm set the next alarm for the next item in the list. Now alarms are pretty accurate normally, but obviously can't be millisecond accurate even then. But in the case of outages for example, it might take a few minutes for an alarm to fire again.Erwin
04/26/2023, 1:00 AMsantosmateo
04/26/2023, 2:39 PMdavidbarratt
04/26/2023, 2:41 PMsantosmateo
04/26/2023, 4:09 PM`
export const sseController = () => {
const { readable, writable } = new TransformStream();
const headers = new Headers();
headers.append("Content-Type", "text/event-stream");
headers.append("Cache-Control", "no-cache");
headers.append("Connection", "keep-alive");
headers.append("Access-Control-Allow-Origin", "*");
headers.append(
"Access-Control-Allow-Headers",
"Origin, X-Requested-With, Content-Type, Accept"
);
const init = { status: 200, statusText: "ok", headers: headers };
const encoder = new TextEncoder();
const writer = writable.getWriter();
NewLog$.subscribe(async (message: any) => {
writer.write(encoder.encode(`data: ${message}\n\n`));
});
setInterval(() => {
writer.write(encoder.encode(`data: ${msg}\n\n`));
}, 5000);
return { init, readable };
`
We call this controller and then construct the response with return new Response(readable, init);
user6251
04/27/2023, 4:41 PMDurable Objects scale well across Objects, but each object is inherently single-threaded. A baseline of 100 req/sec is a good floor estimate of the request rate an individual Object can handle, though this will vary with workload.
The text refers to object instances, right? So if there are 1000s of DO instances, they each get 100 req/sec, right? We don't need nearly as much per instance, but a 100 req/sec limit across all instances of a DO would be a problem.James
04/27/2023, 5:02 PMbret_pat
04/28/2023, 4:01 AM