To help you share state across different workers and manage updates smoothly, I’d recommend using a combination of caching and distributed state management techniques. Here’s a friendly overview:
• Centralized State Management: Consider using a shared in-memory cache like Redis to store your prompts. This way, one main worker can periodically check the cloud storage and update the cache, while the other workers simply read from the cache instead of hitting the storage every time.
• Periodic Updates: Setting up the main worker to regularly fetch the latest prompts from cloud storage and refresh the shared cache can really help keep everyone on the same page without unnecessary queries.
• Worker Communication: A pub/sub system, such as Redis Pub/Sub, can be a great way to let other workers know when the cache has been updated, so they can update their local state if needed.
If you’d like, I’d be happy to walk you through how to set up any of these parts in more detail. Just let me know!