Performance notes - adamcfraser/cbnotes GitHub Wiki

lag-queue

  • change.TimeReceived until added to all channel caches
  • TimeReceived set immediately prior to calling processEntry

lag-queue is made up of:

  • processEntry

    • get changeCache write lock
    • is next sequence
      • _addToCache
      • _addPendingLogs()
    • is pending
      • adds to pending
      • if past maxPending, does _addPendingLogs()
    • was skipped
      • _addToCache
  • _addToCache

    • for each channel
      • gets cache from map (already has write lock from above)
      • channel.addToCache
      • if late, channel.AddLateSequence
  • channel.addToCache

    • gets channel cache write lock
    • _appendChange
      • if latest, iterate over cache looking for duplicate DocID
      • if late, iterate over cache looking for position and duplicate DocID
    • _pruneCache
      • loop - if cache exceeds max, remove first entry