tokers commented on a change in pull request #601:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/601#discussion_r682279807



##########
File path: pkg/apisix/cluster.go
##########
@@ -301,6 +314,74 @@ func (c *cluster) HasSynced(ctx context.Context) error {
        }
 }
 
+// syncSchema syncs schema from APISIX regularly according to the interval.
+func (c *cluster) syncSchema(ctx context.Context, interval time.Duration) {
+       ticker := time.NewTicker(interval)
+       defer ticker.Stop()
+
+       for {
+               if err := c.syncSchemaOnce(); err != nil {
+                       log.Warnf("failed to sync schema: %s", err)
+               }
+
+               select {
+               case <-ticker.C:
+                       continue
+               case <-ctx.Done():
+                       break
+               }
+       }
+}
+
+// syncSchemaOnce syncs schema from APISIX once.
+// It firstly deletes all the schema in the cache,
+// then queries and inserts to the cache.
+func (c *cluster) syncSchemaOnce() error {

Review comment:
       context should be propagated here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to