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

Method mappingWorker

enterprise/tailnet/pgcoord.go:1053–1075  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1051}
1052
1053func (q *querier) mappingWorker() {
1054 defer q.wg.Done()
1055 defer q.logger.Debug(q.ctx, "mapping worker exited")
1056 eb := backoff.NewExponentialBackOff()
1057 eb.MaxElapsedTime = 0 // retry indefinitely
1058 eb.MaxInterval = dbMaxBackoff
1059 bkoff := backoff.WithContext(eb, q.ctx)
1060 for {
1061 allKeys, err := q.mappingQ.acquireBatch(maxBatchSize)
1062 if err != nil {
1063 return
1064 }
1065 mkeys := make([]mKey, 0, len(allKeys))
1066 mkeys = append(mkeys, allKeys...)
1067 err = backoff.Retry(func() error {
1068 return q.mappingQuery(mkeys)
1069 }, bkoff)
1070 if err != nil {
1071 bkoff.Reset()
1072 }
1073 q.mappingQ.done(allKeys...)
1074 }
1075}
1076
1077// peerUpdate is work scheduled in response to a new peer->binding. We need to find out all the
1078// other peers that share a tunnel with the indicated peer, and then schedule a mapping update on

Callers 1

newQuerierFunction · 0.95

Calls 6

mappingQueryMethod · 0.95
WithContextMethod · 0.80
acquireBatchMethod · 0.80
ResetMethod · 0.65
DoneMethod · 0.45
doneMethod · 0.45

Tested by

no test coverage detected