Ah in that case you have multiple things

Ah, in that case you have multiple things you need to await (cause you need to fetch the data and then store it in cache). You could put it all in an async function like so:
const foo = async () => {
// do something
}
// Then just call foo without the await
foo();
const foo = async () => {
// do something
}
// Then just call foo without the await
foo();
There is probably a more clean way to write this, but I'm not that great with JS syntax. Or you could use waitUntil, but I'm not sure how you'd do that in itty durable.
2 Replies
aarhus
aarhus•3y ago
That's what I have ended up doing. It was a logic problem. But splitting it out to separate function and using the early return pattern to check fixed the logic and has reduced the number of calls to the backend 🙂
zegevlier
zegevlierOP•3y ago
Awesome! Glad you could solve it 😄
Want results from more Discord servers?
Add your server