freescout-help-desk / freescout

FreeScout — Free self-hosted help desk & shared mailbox (Zendesk / Help Scout alternative)
https://freescout.net
GNU Affero General Public License v3.0
2.75k stars 468 forks source link

Possible pagination conflict when fetching unseen messages #4047

Closed sofl88 closed 1 month ago

sofl88 commented 1 month ago

Hello.

Since we have some adjustments in our installation and some minor issues with the new fetching library, we did alot of testing recently.

I think I found a missconception in the fetchEmails command when it comes to pagination. -> fetch over 300 (PAGE_SIZE), unseen messages.

When this line is executed the second time, the amount of returned emails changed because most of the messages were set to seen in the previous loop by processMessage > setSeen. https://github.com/freescout-helpdesk/freescout/blob/2d871f27590424e2a33368878a01dd41ebb462e1/app/Console/Commands/FetchEmails.php#L223

So since the entire amount changes but the page is still increasing with every loop, some emails get ignored. I think it also depends on how fast the server flag these emails as seen.

It is not really an issue at the moment for us because we almost never fetch over 300 emails in one run but I thought it would be helpful to inform you guys.

PHP version: 8.0.30 FreeScout version: 1.8.140 Database: MySQL Are you using CloudFlare: No Are you using non-official modules: Yes

Thanks in advance

freescout-helpdesk commented 1 month ago

Thanks for the info. We'll keep in mind. But it looks like so far no one had some issues due to this.