Gebz
Explore posts from servers❔ [Design Problem] Duplication and Concurrency
I have a design issue i need to fix with my application that im building using MailKit and MimeMessage: I created an idle client that will be connecting to an Imap server, upon a new connect it gets all messages received in the inbox, and pushes them to a queue, there's a separate worker thread dequeuing the messages and processing them (parsing them and pushing them to a database). There's a scenario where new messages in the inbox are enqueued to the processing queue, but are not processed in time, then the idle client disconnects. With the current implementation it will try to reconnect, and if the connection is established, it will get all messages and throw them in the queue again resulting in duplicate Messages. I'm not the most experienced software designer and I was hoping someone more seasoned could offer some design advice, maybe my whole design isn't optimal.
Link to the repo:
https://github.com/alyashraf97/Biohazard
4 replies