MCPcopy
hub / github.com/esm-dev/esm.sh / Snapshot

Method Snapshot

server/build_queue.go:74–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72}
73
74func (q *BuildQueue) Snapshot() []map[string]any {
75 q.lock.Lock()
76 defer q.lock.Unlock()
77
78 items := make([]map[string]any, 0, len(q.queue)+q.pending.Len())
79 for task := range q.queue {
80 items = append(items, map[string]any{
81 "waitClients": len(task.waitChans),
82 "createdAt": task.createdAt.Format(time.RFC1123),
83 "path": task.ctx.Path(),
84 "status": task.ctx.status,
85 })
86 }
87 for el := q.pending.Front(); el != nil; el = el.Next() {
88 task, ok := el.Value.(*BuildTask)
89 if !ok {
90 continue
91 }
92 items = append(items, map[string]any{
93 "waitClients": len(task.waitChans),
94 "createdAt": task.createdAt.Format(time.RFC1123),
95 "path": task.ctx.Path(),
96 "status": task.ctx.status,
97 })
98 }
99 return items
100}
101
102func (q *BuildQueue) startSchedulerLocked() {
103 if q.scheduler || q.chann == 0 || q.pending.Len() == 0 {

Callers 1

esmRouterFunction · 0.80

Calls 3

PathMethod · 0.80
NextMethod · 0.80
LenMethod · 0.45

Tested by

no test coverage detected