Help with sleep/serverless function
grillekkj
FREEOP

a year ago

I have an nestJS backend on a monorepo with 5 different microservices and i want them to be called on demand and sleep most of the time, i thought about doing it with redis pub/sub but i think listening pub/sub dont let the service sleep? what can i do

Solved$10 Bounty

5 Replies

grillekkj
FREEOP

a year ago

N/A


grillekkj
FREEOP

a year ago

to better explain: 1 microservice will be running 24/7 and that service will route messages on the pub/sub to different microservices so it will publish idk "send:message" and the message sender should wake up, send a message, sleep again and basically that for all the other 5 microservices but my question is the sleep part, idk if the listener for the redis pub/sub keeps the service awake and if so how to make it sleep and still work as expected


skyaviatour
HOBBY

a year ago

sleeping implies completely pausing the service’s execution as far as i understand, so it wouldn’t listen to redis anymore. you’d either have to adapt to redis streams and have the service check every x seconds/minutes with cron, or have another service up 24/7 listening to all channels, and triggering the microservices actions via an http route


grillekkj
FREEOP

a year ago

yeah, i kinda figured it out yesterday... I just completely removed all redis from my project and implemented an endpoint /events wich receives an event_type and a data with all the data i need for that event


Status changed to Solved chandrika 11 months ago


Woohoo! Great to hear. (Going to mark as solved.)


Status changed to Awaiting User Response Railway 11 months ago


Status changed to Solved angelo-railway 11 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...