Changeset 406 in code for trunk/downstream.go


Ignore:
Timestamp:
Aug 20, 2020, 3:38:57 PM (5 years ago)
Author:
contact
Message:

Replace networkHistory.offlineClients with clients

Keep the ring buffer alive even if all clients are connected. Keep the
ID of the latest delivered message even for online clients.

As-is, this is a net downgrade: memory usage increases because ring
buffers aren't free'd anymore. However upcoming commits will replace the
ring buffer with log files. This change makes reading from log files
easier.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r404 r406  
    865865                }
    866866
    867                 seq, ok := history.offlineClients[dc.clientName]
     867                seq, ok := history.clients[dc.clientName]
    868868                if !ok {
    869869                        continue
    870870                }
    871                 delete(history.offlineClients, dc.clientName)
    872 
    873                 // If all clients have received history, no need to keep the
    874                 // ring buffer around
    875                 if len(history.offlineClients) == 0 {
    876                         delete(net.history, target)
    877                 }
     871                history.clients[dc.clientName] = history.ring.Cur()
    878872
    879873                consumer := history.ring.NewConsumer(seq)
Note: See TracChangeset for help on using the changeset viewer.