MCPcopy Index your code
hub / github.com/coder/coder / processUpdate

Method processUpdate

coderd/agentapi/metadatabatcher/metadata_batcher.go:240–260  ·  view source on GitHub ↗

processUpdate adds a metadata update to the batch with deduplication based on timestamp.

(update update)

Source from the content-addressed store, hash-verified

238
239// processUpdate adds a metadata update to the batch with deduplication based on timestamp.
240func (b *Batcher) processUpdate(update update) {
241 ck := compositeKey{
242 agentID: update.agentID,
243 key: update.key,
244 }
245
246 // Check if key already exists and only update if new value is newer.
247 existing, exists := b.batch[ck]
248 if exists && update.collectedAt.Before(existing.collectedAt) {
249 return
250 }
251
252 b.batch[ck] = value{
253 v: update.v,
254 error: update.error,
255 collectedAt: update.collectedAt,
256 }
257 if !exists {
258 b.currentBatchLen.Add(1)
259 }
260}
261
262// run runs the batcher loop, reading from the update channel and flushing
263// periodically or when the batch reaches capacity.

Callers 1

runMethod · 0.95

Implementers 13

tableStatscoderd/database/migrations/migrate_tes
UsageTrackercoderd/workspacestats/tracker.go
uuidSetcoderd/workspacestats/tracker.go
DBBatchercoderd/workspacestats/batcher.go
StatsBatchercoderd/workspacestats/workspacestatste
Batchercoderd/agentapi/metadatabatcher/metada
DataBuilderprovisionersdk/proto/dataupload.go
connManagertailnet/test/integration/integration.g
multiCloserenterprise/cli/server.go
Indexagent/filefinder/delta.go
fakeWatcheragent/agentcontainers/api_test.go
noopWatcheragent/agentcontainers/watcher/noop.go

Calls 1

AddMethod · 0.65

Tested by

no test coverage detected