So I have a CF worker that's supposed to filter requests based on their properties and track some state across requests. At the end of the request I want to update the linked state.
async updateState() {
return this.getState().then((state) => this.env("KV_NAMESPACE").put(this.getCacheKey(), JSON.stringify(state), { expirationTtl: TOKEN_TTL_SEC }));
}
However, this update costs me up to 400ms, sometimes even more.
Saved payload is ~1KB and the key is ~500B
Is that expected?
Is there any way to run this update async, i.e. after returning my response to the browser?