Skip to content
  • Jim Nelson's avatar
    Archive removes two messages, fails to show new: Closes #6085 · 9ac7349f
    Jim Nelson authored
    This is a tricky timing bug triggered by Gmail sending EXPUNGE and
    EXISTS notifications in a particular order with a slight timing delay
    between them.
    
    Normally Gmail will send one or more EXPUNGE notifications followed by
    EXISTS to finish up a list of removal notifications.  Even if the
    client sends an APPEND followed by STORE/EXPUNGE, the EXPUNGE
    notifications are first.
    
    However, if the client STORE/EXPUNGEs on one connection and a new
    message arrives from another (or via SMTP), Gmail will issue an
    EXISTS (append), wait 250 msec, then issue the EXPUNGE(s).  In
    that 250msec delay, Geary has already turned around and requested
    the new message, which no longer exists at the reported position
    because the EXPUNGEs (which have not arrived yet) have shifted it
    downward.
    
    The solution is to pause when notifications come in so all can
    be accounted for, shifting positions as necessary.
    9ac7349f