Lets say I have two orders updated in the same millisecond.
If I retrieve 5 orders in each call using updated_at_min time, then there are chances that in the first call, one of the order is not retrieved, and in the subsequent call, since the seconds value is increased, we won't be able to retrieve one of the orders ever.
Shopify doesnt have milliseconds parameter in update_at_min parameter.
How can we tackle the above scenario?
Maybe you can use webhooks instead, https://help.shopify.com/en/manual/orders/notifications/webhooks
You can just subscribe to the order.updated webhook with the endpoint url of your app. Whenever an order is updated, your app will receive the order payload.
You may want to try using pagination for your subsequent calls.
Any real-time, event driven scenario such as this is begging for webhooks. Since they are available if it was me I would take advantage of them. Polling via API requests when it comes to milliseconds isn't practical. There's processing time, network response time, and too many other variables which can lead to inconsistent results.