Is this async task queue pattern causing race conditions or am I overthinking it?
Hey folks, I've been refactoring a background job processor for our order fulfillment system. The current approach uses a simple in-memory queue with setInterval polling every 5 seconds. Here's the core polling function: if (queue.length > 0) { processJob(queue.shift()) } catch (e) { logger.error(e) } I'm worried we're losing jobs during high throughput periods. Should I be using a proper message queue instead, or is this acceptable for our ~200 orders/day volume? We're running on a single server for now but planning to scale horizontally soon.