cknight
Deno KV: How to query for all records that have been updated since a given timestamp?
Yes, unless the number of records is very small, you'd want the timestamp as part of the keys so that you can do a
list
on it starting at a given timestamp. This could be a secondary index key or even a primary key where you "delete and set with new timestamp" atomic transaction each time the entry gets updated. However, as you mention, a secondary index may work best depending on your exact use case.3 replies
Cannot find module '@alloc/quick-lru'
See https://github.com/denoland/deno/issues/21884. You can try deleting node_modules and running again.
3 replies
Is there a way to obtain Deno.cron schedule info?
I don't think there's anything locally. For Deploy you could hook into their unofficial API:
https://dash.deno.com/projects/your-deploy-project-name/cron?_data_
using token=<your_deno_api_token>
cookie.4 replies
Is there a way to specify a range and list from KV?
There's also the
getMany
interface to get multiple keys at once. https://deno.land/api@v1.41.3?s=Deno.Kv&unstable=&p=prototype.getMany5 replies
New fresh project comes out of the box with errors
Hmm. I'll assume you haven't changed the
deno.json
file created. In which case, try restarting the language server (Deno: Restart Language Server
command in VS code) and/or restarting VS Code. I've just upgraded to 1.41.3 and have the same import as you without issue. Finally, check you have the latest LSP extension installed (I'm running v3.35.1).10 replies
Is there a way to write a Deno.AtomicCheck that succeeds for any non-null versionstamp?
Not as a one step transaction. Your best bet is to first
kv.get
, capture the version stamp, manually validate it's not null then use it as a check in an atomic transaction.3 replies
Caching results from API
I'd use KV to store the cached entry (assuming data is always less than 64kb). When a request
get
s the data from KV, if it isn't there, then call the API and store the value. You can use Deno cron to call the API every 24 hours:
11 replies
What to do if they are attacking a project of mine?
This is great to hear, thanks for sharing. I think people have significant concerns as there is no public policy or recognition from Deno around this and users feel it's on them to take the risk and impact of a DoS attack, while frustrated that this doesn't appear to be a priority. Publicly recognising the issue and documenting the above (a DoS policy and potential roadmap) would go a long way towards giving people more confidence on this subject. Finally, in lieu of your own option 3 WAF/DoS protection, official documentation (or link to the existing article above) on setting up such protection via other providers like Cloudflare would again boost confidence. Many folk are likely unaware of that possibility or unable to configure it on their own without help/documentation. Keep up the great work!
22 replies
How to modify HTTP cache folder
You can change the cache directory with the
DENO_DIR
environment variable. See https://docs.deno.com/runtime/manual/basics/env_variables#special-environment-variables for more info.5 replies
deno oak : howto force reply immediatly, and process the request later ?
The general idea is to kick off an async process without awaiting it and immediately return after the start of that async process. The async process should continue running after the response is returned. You could also use
queueMicrotask(() => {})
or setTimeout(() => {}, 0)
to put code on the event loop which could, if done correctly, execute after the response is returned. I'm not familiar with Oak however and if it awaits anything during returning of the response (which might then process the event loop ahead of the response being returned to the client).4 replies