Skip to content

Commit

Permalink
rm version cache
Browse files Browse the repository at this point in the history
  • Loading branch information
zuiwuchang committed Sep 18, 2024
1 parent 46ea42c commit dae640b
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions m/web/api/v1/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type System struct {
web.Helper
maxage int
startAt time.Time
rw sync.RWMutex
mutex sync.RWMutex
core string
}

Expand Down Expand Up @@ -46,22 +46,12 @@ func (h *System) Title(c *gin.Context) {
})
}
func (h *System) getCore() (s string) {
h.rw.RLock()
s = h.core
h.rw.RUnlock()
if s != `` {
return
}

h.rw.Lock()
defer h.rw.Unlock()
s = h.core
if s != `` {
return
}
h.mutex.Lock()
defer h.mutex.Unlock()

runtime, e := js.New(configure.Default().System.Script)
if e != nil {
s = h.core
return
}
s, _ = runtime.Version()
Expand All @@ -70,6 +60,7 @@ func (h *System) getCore() (s string) {
}
return
}

func (h *System) Version(c *gin.Context) {
h.SetHTTPCacheMaxAge(c, h.maxage)
h.ServeLazyJSON(c, ``, h.startAt, func() (any, error) {
Expand Down

0 comments on commit dae640b

Please sign in to comment.