sathoro
05/13/2023, 7:30 PMsathoro
05/13/2023, 7:36 PMsathoro
05/13/2023, 7:37 PMawait this.state.storage.get("data")
returns the correct state
await this.toJSON()
returns the blank datasathoro
05/13/2023, 7:37 PMsathoro
05/13/2023, 8:13 PMuserId
from the name into storage:
js
async onLoad() {
if (!this.userId && this.state.idFromName) {
console.log("setting userId from state", this.state.idFromName);
this.userId = this.state.idFromName;
this.persist();
}
}
and added this to my alarm handler:
js
if (!this.state.initialized) {
await this.loadFromStorage();
}
sathoro
05/13/2023, 8:21 PMhttps://cdn.discordapp.com/attachments/773219443911819284/1107039993895079986/image.pngâ–¾
Iann
05/13/2023, 11:53 PMUnsmart | Tech debt
05/14/2023, 12:01 AMWalshy | Pages
05/14/2023, 12:03 AMMdLiton
05/14/2023, 1:41 AMcharl
05/14/2023, 12:23 PMsathoro
05/14/2023, 1:19 PMsathoro
05/14/2023, 1:20 PMsathoro
05/14/2023, 1:22 PMSamy
05/14/2023, 2:53 PMconst doStub = DO_NAMESPACE.get(id);
const doInstantiated = await doStub.exists();
if (doInstantiated) {
return doStub.fetch(request)
} else {
// Handle the request another way
}
The goal is to avoid creating DOs near the us-central1 region since DO currently can't move between locations, and I'd like to optimize them to be as closed from the first end-user making a request to it, and not out backend.sathoro
05/14/2023, 3:03 PMHardAtWork
05/14/2023, 3:09 PMsathoro
05/14/2023, 3:16 PMUnsmart | Tech debt
05/14/2023, 3:18 PMUnsmart | Tech debt
05/14/2023, 3:18 PMzegevlier
05/14/2023, 3:19 PMSamy
05/14/2023, 3:32 PMSamy
05/14/2023, 3:32 PMSamy
05/14/2023, 3:33 PMsathoro
05/14/2023, 3:34 PMitty-durable
this is about 8 lines of code totalsathoro
05/14/2023, 3:34 PMSamy
05/14/2023, 3:35 PMSkye
05/14/2023, 3:38 PMSamy
05/14/2023, 3:39 PMSamy
05/14/2023, 3:40 PM