useCurrent adds a completion to the WaitGroup if the current version of the cached resource has not been acked yet, allowing the caller to wait for the ACK.
(typeURL string, nodeIDs []string, wg *completion.WaitGroup)
| 117 | // version of the cached resource has not been acked yet, allowing the |
| 118 | // caller to wait for the ACK. |
| 119 | func (m *AckingResourceMutatorWrapper) useCurrent(typeURL string, nodeIDs []string, wg *completion.WaitGroup) { |
| 120 | m.locker.Lock() |
| 121 | defer m.locker.Unlock() |
| 122 | |
| 123 | if wg == nil { |
| 124 | return |
| 125 | } |
| 126 | |
| 127 | if m.restoring { |
| 128 | // Do not wait for acks when restoring state |
| 129 | m.logger.Debug("useCurrent: Restoring, skipping wait for ACK", |
| 130 | logfields.XDSTypeURL, typeURL, |
| 131 | ) |
| 132 | return |
| 133 | } |
| 134 | |
| 135 | // Add a completion object for the current version so that the caller may wait for the N/ACK |
| 136 | m.addCurrentVersionCompletion(typeURL, nodeIDs, wg, nil) |
| 137 | } |
| 138 | |
| 139 | func TestUpsertSingleNode(t *testing.T) { |
| 140 | logger := hivetest.Logger(t) |
no test coverage detected