mirror of
https://github.com/coder/coder.git
synced 2025-07-23 21:32:07 +00:00
Log lock acquisition time for https://github.com/coder/internal/issues/371
Setting default claimer to avoid panics Signed-off-by: Danny Kopping <danny@coder.com>
This commit is contained in:
@ -566,6 +566,7 @@ func New(options *Options) *API {
|
||||
f := appearance.NewDefaultFetcher(api.DeploymentValues.DocsURL.String())
|
||||
api.AppearanceFetcher.Store(&f)
|
||||
api.PortSharer.Store(&portsharing.DefaultPortSharer)
|
||||
api.PrebuildsClaimer.Store(&prebuilds.DefaultClaimer)
|
||||
buildInfo := codersdk.BuildInfoResponse{
|
||||
ExternalURL: buildinfo.ExternalURL(),
|
||||
Version: buildinfo.Version(),
|
||||
|
@ -111,14 +111,19 @@ func (c *Controller) reconcile(ctx context.Context, templateID *uuid.UUID) {
|
||||
default:
|
||||
}
|
||||
|
||||
logger.Debug(ctx, "starting reconciliation")
|
||||
|
||||
// get all templates or specific one requested
|
||||
err := c.store.InTx(func(db database.Store) error {
|
||||
start := time.Now()
|
||||
err := db.AcquireLock(ctx, database.LockIDReconcileTemplatePrebuilds)
|
||||
if err != nil {
|
||||
logger.Warn(ctx, "failed to acquire top-level prebuilds lock; likely running on another coderd replica", slog.Error(err))
|
||||
logger.Warn(ctx, "failed to acquire top-level prebuilds reconciliation lock; likely running on another coderd replica", slog.Error(err))
|
||||
return nil
|
||||
}
|
||||
|
||||
defer logger.Debug(ctx, "acquired top-level prebuilds reconciliation lock", slog.F("acquire_wait_secs", fmt.Sprintf("%.4f", time.Since(start).Seconds())))
|
||||
|
||||
innerCtx, cancel := context.WithTimeout(ctx, time.Second*30)
|
||||
defer cancel()
|
||||
|
||||
|
Reference in New Issue
Block a user