Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[support request] does enter_idle limit the monitoring to one mailbox? #282

Open
dewi-ny-je opened this issue Jan 23, 2024 · 3 comments
Open

Comments

@dewi-ny-je
Copy link

After years of silent and perfect operation, I was checking imapfilter to see if I could combine the three instances I have into one.
I noticed/remembered however that I am using enter_idle, which blocks execution of commands until an update is received.

Is then a separate instance per IMAP server the only solution, or are there better ones?

@franciscodavid
Copy link

I know it is not the same, but I combined multiple instances into one with an approach like the one below:

function sync_mail()
  local servers = { server1, server2 }
  for _, server in pairs(servers) do
    msgs = server['INBOX']:select_all()
    if #msgs > 0 then
      ...
    end
  end
end

function forever()
  while true do
    sync_mail()
    sleep(60)
  end
end

recover(forever)

@dewi-ny-je
Copy link
Author

It's a periodic check, not IDLE but worth a try.

@lefcha
Copy link
Owner

lefcha commented Apr 6, 2024

Well the IMAP IDLE is a blocking network call, so basically the whole program stops waiting for something to be received from the socket. There's a different extension to support multiple mailboxes the IMAP NOTIFY Extension, but it's not supported by imapfilter yet.

But for multiple IDLE on different servers, the only way would be to either have multiple threads or somehow doing non-blocking networking calls with Lua coroutines (eg. Lua Copas or similar).

I think the easiest way is to run multiple processes as you already do, or otherwise don't use IDLE but do periodic polling as suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants