feat(storage): add native PostgreSQL runtime and verified offline application import
Build and publish container images / images (push) Failing after 12m29s

This commit is contained in:
Anya Tokugawa committed 2026-11-15 05:47:14 +09:00
1 parent 96065d1e89
commit 0ba1dcfef0
243 files changed
+21441 -3090

No files matched your search

+43 -3
View File
@@ -32,6 +32,12 @@ type Runner struct {
registry *Registry
opts RunnerOptions
mu sync.Mutex
stopping bool
stopCtx context.Context
cancel context.CancelFunc
workers sync.WaitGroup
stopOnce sync.Once
done chan struct{}
}
func NewRunner(queue Queue, registry *Registry, opts RunnerOptions) *Runner {
@@ -41,7 +47,30 @@ func NewRunner(queue Queue, registry *Registry, opts RunnerOptions) *Runner {
if opts.Active == nil {
opts.Active = new(atomic.Int64)
}
return &Runner{queue: queue, registry: registry, opts: opts}
ctx, cancel := context.WithCancel(context.Background())
return &Runner{queue: queue, registry: registry, opts: opts, stopCtx: ctx, cancel: cancel, done: make(chan struct{})}
}
// Stop closes admission permanently, cancels handlers and waits for persisted
// completions. A timeout does not mean workers have exited: callers must keep
// ownership/database resources alive and may call Stop again to await them.
func (r *Runner) Stop(ctx context.Context) error {
r.stopOnce.Do(func() {
r.cancel()
go func() {
r.mu.Lock()
r.stopping = true
r.mu.Unlock()
r.workers.Wait()
close(r.done)
}()
})
select {
case <-r.done:
return nil
case <-ctx.Done():
return ctx.Err()
}
}
func (r *Runner) report(stage string, job *Job, err error) {
@@ -57,7 +86,10 @@ func (r *Runner) Running() int64 { return r.opts.Active.Load() }
func (r *Runner) Dispatch(ctx context.Context) {
r.mu.Lock()
defer r.mu.Unlock()
for n := 0; n < 32 && ctx.Err() == nil; n++ {
if r.stopping || r.stopCtx.Err() != nil {
return
}
for n := 0; n < 32 && ctx.Err() == nil && r.stopCtx.Err() == nil; n++ {
settings, err := r.queue.Settings(ctx)
if err != nil {
r.report("settings", nil, err)
@@ -81,7 +113,15 @@ func (r *Runner) Dispatch(ctx context.Context) {
}
r.opts.Active.Add(1)
r.report("start-log", job, r.queue.Started(ctx, job))
go r.execute(ctx, job)
workerCtx, cancel := context.WithCancel(ctx)
stop := context.AfterFunc(r.stopCtx, cancel)
r.workers.Add(1)
go func() {
defer r.workers.Done()
defer cancel()
defer stop()
r.execute(workerCtx, job)
}()
}
}