Delay with Langchain in backgound functions

Hello everyone,

First and foremost, I’d like to extend my gratitude for all the suggestions and insights you’ve provided. After considering the recommendations, I managed to solve the problem using a hybrid approach inspired by your collective input.

  1. Upgrade to Business Plan: I decided to move to the Business version to leverage the benefits of the Persistence Server.
  2. Background Task Implementation: Right upon loading the form, I initiate a background task that constantly monitors the database, waiting for a user message.
  3. Message Processing: When this task picks up a new message in the database, it processes it and then removes the message once done.
  4. Task Restart: After the background task finishes processing the message, I terminate it and launch another to be ready for the next user input.

I share a template with the implementation I came up with.

If anyone has suggestions to further optimize the process, I’d be more than grateful for your feedback.

Thank you all for your support and collaboration!

2 Likes