O365/wsgetmail fetching emails in loop

Hi,
we moved away from legacy fetchmail integration and started using wsgetmail with office365.
Most of the time it works perfectly fine, but time to time in random() it happens that wsgetmail stucks and pulls the same message unlimited count even if we delete the message from the mailbox. I tried to setup also lock for the cron, still the issue persist.
Our wsgetmail config:
{
“client_id”: “redacted”,
“tenant_id”: “redacted”,
“secret”: “redacted”,
“global_access”: 1,
“username”: “help@redacted.com”,
“folder”: “Inbox”,
“command”: “/opt/rt5/bin/rt-mailgate”,
“command_args”: “–url=https://redacted/ --queue=General --action=correspond”,
“action_on_fetched”: “delete”
}