-2

I'm working on a Chrome extension that interacts both with the Gmail UI as well as Gmail's IMAP implementation.

The back-end of my app needs to monitor all incoming e-mails for each user and update the DB whenever a message/sender of interest is received.

I can set up a "user initiated" poll, where I scan all new messages whenever they have my app loaded, but there are draw backs since my app is then only up-to-date when the user is in browser. I'd like to be up to date at all times...

Off-hand I've considered a simple server poll of every user, such as:

For x = 0 to All users
    Fetch ALL msg where UID > lastMessageID
        if msg.sender == something i care about
            UPDATE table...
<repeat>

And I've also thought about using IMAP IDLE such as:

For all users, establish imap idle call
    for any user whos imap idle returned
        if msg.sender == something i care about
            UPDATE table...

What I'm trying to figure out though is which is going to scale better as I'll need to monitor 5-10k accounts minimum...

Is there anything I'm missing? Is there a simpler way of doing this for a large number of accounts?

  • Note, other than scanning the messages and updating a table -- I do not need to store any of the messages.
4

1 回答 1

0

实现 IDLE 是一个更好的选择,因为它也不会给服务器带来负担。

如果Polling它有责任client监控每一个变化。例如,如果从其他客户端(如 Web 界面或通过某些移动设备)删除邮件,那么要监控这种情况,您必须在每次轮询时扫描整个邮箱。

whereas

如果IDLE它有责任Server让您了解邮箱状态发生的任何变化,无论是邮件移动、读取还是删除操作。此外,IDLE 命令的可伸缩性也不应该是问题。

于 2013-03-22T05:46:22.337 回答