Receive new late sequence
(change *LogEntry)
| 787 | |
| 788 | // Receive new late sequence |
| 789 | func (c *singleChannelCacheImpl) AddLateSequence(change *LogEntry) { |
| 790 | // Add to lateLogs. |
| 791 | lateEntry := &lateLogEntry{ |
| 792 | logEntry: change, |
| 793 | arrived: time.Now(), |
| 794 | listenerCount: 0, |
| 795 | } |
| 796 | c.lateLogLock.Lock() |
| 797 | c.lateLogs = append(c.lateLogs, lateEntry) |
| 798 | c.lastLateSequence = change.Sequence |
| 799 | // Currently we're only purging on add. Could also consider a timed purge to handle the case |
| 800 | // where all the listeners get caught up, but there aren't any subsequent late entries. Not |
| 801 | // a high priority, as the memory overhead for the late entries should be trivial, and probably |
| 802 | // doesn't merit |
| 803 | c._purgeLateLogEntries() |
| 804 | c.lateLogLock.Unlock() |
| 805 | } |
| 806 | |
| 807 | // Purge entries from the beginning of the list having no active listeners. Any newly connecting clients |
| 808 | // will get these entries directly from the cache. Always maintain |