feat(storage): add native PostgreSQL runtime and verified offline application import
Build and publish container images / images (push) Failing after 12m29s
Build and publish container images / images (push) Failing after 12m29s
This commit is contained in:
1 parent
96065d1e89
commit
0ba1dcfef0
243 files changed
+21441
-3090
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -44,13 +45,32 @@ type Server struct {
|
||||
schedulerRunner *dregarnuhr.Runner
|
||||
eventHandlersOnce sync.Once
|
||||
eventHandlers *dregarnuhr.Registry
|
||||
backgroundCtx context.Context
|
||||
backgroundCancel context.CancelFunc
|
||||
backgroundWG sync.WaitGroup
|
||||
workerRelease func() error
|
||||
closeOnce sync.Once
|
||||
closeDone chan struct{}
|
||||
closeErr error
|
||||
}
|
||||
|
||||
func New(
|
||||
st *store.Store,
|
||||
) *Server {
|
||||
s, err := NewChecked(st)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// NewChecked refuses to serve when mandatory scheduler initialization fails.
|
||||
// New remains a compatibility wrapper for existing constructors and tests.
|
||||
func NewChecked(st *store.Store) (*Server, error) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
s := &Server{
|
||||
backgroundCtx: ctx, backgroundCancel: cancel, closeDone: make(chan struct{}),
|
||||
mux: http.NewServeMux(),
|
||||
store: st,
|
||||
previewSlots: make(chan struct{}, 1),
|
||||
@@ -111,11 +131,14 @@ func New(
|
||||
s.registerRoutes()
|
||||
|
||||
if !st.ReadOnly && !st.BackgroundJobsDisabled {
|
||||
if err := s.startEventScheduler(); err != nil {
|
||||
cancel()
|
||||
return nil, err
|
||||
}
|
||||
s.startGCWorker()
|
||||
s.startEventScheduler()
|
||||
}
|
||||
|
||||
return s
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func (s *Server) registerStaticRoutes() {
|
||||
@@ -378,8 +401,5 @@ func (s *Server) Run(addr string) error {
|
||||
addr,
|
||||
)
|
||||
|
||||
return http.ListenAndServe(
|
||||
addr,
|
||||
s.handler(),
|
||||
)
|
||||
return s.RunContext(context.Background(), addr)
|
||||
}
|
||||
Reference in new issue
Block a user