v1: Duplicate MailboxUpdate generated upon Select
- Dominant language
- Go
- Stars
- 2.3k
- Forks
- 358
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 1
Description
_Noticed on [aerc](https://aerc-mail.org), that uses go-imap 1.2.1. I assume that this would not happen with v2, that simply ignores `Recent` AFAIU._
When one does something like `Client.Select("directoryname", false)` ([aerc code](https://git.sr.ht/~rjarry/aerc/tree/7cb8e0e7ce2415ac4e9c05834c919c0edd9655b4/item/worker/imap/open.go#L15)), go-imap generates **two** `MailboxUpdate` in the same "10^(-toomuch) second", supposedly one for `* 172 EXISTS` and one for `* 1 RECENT` (see aerc log excerpt below).
However, since `MailboxUpdate`s trigger a mail check in aerc, this duplication causes unneeded perceived latency, and it'd be great to fix this in go-imap v1.
Is it something you'd consider fixing? And if not, would you consider patches against v1 (and eventually release a 1.2.x), or should we consider v1 dead dead?
Thanks, Simon
aerc log excerpt
```
DEBUG 2025/04/08 10:29:34.946181 open.go:13: [WorkMail] Opening INBOX/Informatique/GCC
TRACE 2025/04/08 10:29:36.447913 idler.go:76: [WorkMail] idler (start): start idle after debounce
TRACE 2025/04/08 10:29:36.447981 worker.go:272: [WorkMail] (= *client.StatusUpdate
TRACE 2025/04/08 10:29:36.447995 worker.go:272: [WorkMail] (= *client.MailboxUpdate
TRACE 2025/04/08 10:29:36.448010 worker.go:272: [WorkMail] (= *client.MailboxUpdate
```
Contributor guide
Research direction
Start by tracing Client.Select and the code that turns the EXISTS and RECENT responses into MailboxUpdate events. Reproduce the aerc log’s duplicate updates against go-imap v1, then verify that selecting a mailbox produces only the necessary update while preserving correct mailbox state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100