From e5a3da3bcf4024156b2308944c7038b078437e58 Mon Sep 17 00:00:00 2001 From: adranwit Date: Fri, 6 Dec 2024 12:52:58 -0800 Subject: [PATCH] move mode time to private --- gateway/router/resource.go | 4 ++-- view/discover/columns.go | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gateway/router/resource.go b/gateway/router/resource.go index 65dd0998..120fae5d 100644 --- a/gateway/router/resource.go +++ b/gateway/router/resource.go @@ -101,8 +101,8 @@ func (r *Resource) Init(ctx context.Context) error { return err } - if r.ColumnsDiscovery && (!columnCacheExists || r.Resource.ModTime().After(r.ColumnsCache.ModTime)) { - r.ColumnsCache.ModTime = r.Resource.ModTime() + if r.ColumnsDiscovery && (!columnCacheExists || r.Resource.ModTime().After(r.ColumnsCache.ModTime())) { + r.ColumnsCache.SetModTime(r.Resource.ModTime()) if err := r.ColumnsCache.Store(ctx); err != nil { return err } diff --git a/view/discover/columns.go b/view/discover/columns.go index 0017f777..e0976e09 100644 --- a/view/discover/columns.go +++ b/view/discover/columns.go @@ -15,11 +15,19 @@ type ( fs afs.Service cfs afs.Service Items map[string]view.Columns - ModTime time.Time SourceURL string + modTime time.Time `yaml:"-"` } ) +func (c *Columns) SetModTime(modTime time.Time) { + c.modTime = modTime +} + +func (c *Columns) ModTime() time.Time { + return c.modTime +} + func (c *Columns) Load(ctx context.Context) error { data, err := c.cfs.DownloadWithURL(ctx, c.SourceURL) if err == nil {