I have a scheduled batch that runs every 3 minutes. That batch will pick records when the last modified date is lesser than 2 minutes from the current time. The records falling in the criteria will be sent for deletion of some related records and then sent to other system.
When the record is updated at say 10:20, deletion has happened at 10:21 and callout log is created at 10:23. Ideally deletion and log should be in the same time or can be some less difference in seconds.
Is user's timezone will be an issue?
Query criteria for records.
DateTime timeframe = Datetime.now().addMinutes(-2);
query = 'select id from contact where lastmodifieddate < timeframe';