publishCacheInvalidate broadcasts a cache invalidation event so peer replicas refresh whatever in-memory state mirrors disk. No-op when natsClient is not wired (standalone mode).
(subject string, evt messaging.CacheInvalidateEvent)
| 190 | // replicas refresh whatever in-memory state mirrors disk. No-op when |
| 191 | // natsClient is not wired (standalone mode). |
| 192 | func (g *GalleryService) publishCacheInvalidate(subject string, evt messaging.CacheInvalidateEvent) { |
| 193 | g.Lock() |
| 194 | nc := g.natsClient |
| 195 | g.Unlock() |
| 196 | if nc == nil { |
| 197 | return |
| 198 | } |
| 199 | if err := nc.Publish(subject, evt); err != nil { |
| 200 | xlog.Warn("Failed to broadcast cache invalidation", "subject", subject, "error", err) |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | // BroadcastModelsChanged notifies peer replicas that a model config was |
| 205 | // created, edited, or removed out-of-band of the gallery install/delete |
no test coverage detected