fresh
fresh copied to clipboard
kvdex.collection.listenQueue not responsive(radio silent) in local development
Hi,
I'm using fresh v1.6.1 and kvdex v0.28.3 in a new project and i'm facing some challenges making listenQueue from kvdex responsive.
For reference, i fired enqueue() inside a grammY middleware then i placed my listenQueue() inside the main.ts
file of my fresh project but nothing happened when enqueue()
was being fired(i logged the result inside a console.log
and it returned a positive response).
Then i decided to do this crazy this crazy thing by wrapping all my listenQueue()
inside a queues.ts
file in the root folder and calling inside fresh.gen.ts
and surprisingly, they started working(I haven't added any new route or island after that).
NB: i have yet to try kv.listenQueue()
directly inside main.ts
file so i don't know if that works for me or not. BTW, my environment is github codespaces
Would you mind providing a code example of how listenQueue()
was being called in your main.ts file? And possibly how it looks now in your queue.ts file?
I would also suggest trying kv.listenQueue()
and kv.enqueue()
to identify if it is a kvdex specific issue.
Thanks for replying.
-
Here is the code itself when it was being called in main.ts
-
and it's basically the same thing in my queues.ts file with an extra queue listener
-
Also, here's how i was using
.collection.enqueue
I tried both kv.listenQueue()
and kv.enqueue()
but it still didn't catch anything
So it looks like it's not kvdex specific issue. I'll create a new fresh project and use a minimal example to reproduce the issue again
So i created a simple example inside a new fresh app. When you start the app with deno task start
and visit http://localhost:8000/api/joke, you see the output in the terminal
Both listenQueue()
, enqueue()
from native kv and kvdex are being used inside the main.ts
as well as queues.ts
files
I think this is an issue fresh in local development, in particularly from dev.ts
file when because i deployed the example repo to deno deploy, the queues are being processed effectively
As a temporary fix, i imported queues.ts inside fresh.config.ts instead of main.ts to make it work in local developement
@waptik What are the exact steps to reproduce the error?
@waptik What are the exact steps to reproduce the error?
- Fork the repo based on this commit in your local environment
- Start the app with
deno task start
- Visit
http://localhost:8000/api/joke
orHOST_URL/api/joke
to add jobs to queue