1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-31 03:45:17 +00:00

use mutex as field instead of embedded (#3480)

This commit is contained in:
Prateek Pandey 2022-03-28 11:31:33 +05:30 committed by GitHub
parent 88afd0dd31
commit 2ce205b9e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -207,10 +207,10 @@ func (ws *WebhookServer) updateAnnotationInGR(gr *kyverno.GenerateRequest, logge
if len(grAnnotations) == 0 {
grAnnotations = make(map[string]string)
}
ws.Lock()
ws.mu.Lock()
grAnnotations["generate.kyverno.io/updation-time"] = time.Now().String()
gr.SetAnnotations(grAnnotations)
ws.Unlock()
ws.mu.Unlock()
_, err := ws.kyvernoClient.KyvernoV1().GenerateRequests(config.KyvernoNamespace).Update(contextdefault.TODO(), gr, metav1.UpdateOptions{})
if err != nil {
logger.Error(err, "failed to update generate request for the resource", "generate request", gr.Name)

View file

@ -126,7 +126,7 @@ type WebhookServer struct {
promConfig *metrics.PromConfig
sync.RWMutex
mu sync.RWMutex
}
// NewWebhookServer creates new instance of WebhookServer accordingly to given configuration