Skip to content

Commit f6909ff

Browse files
committed
chore: polish
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
1 parent 74f5dd7 commit f6909ff

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

enterprise/coderd/prebuilds/reconcile.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type StoreReconciler struct {
4444
running atomic.Bool
4545
stopped atomic.Bool
4646
done chan struct{}
47-
provisionNotifyCh chan *database.ProvisionerJob
47+
provisionNotifyCh chan database.ProvisionerJob
4848
}
4949

5050
var _ prebuilds.ReconciliationOrchestrator = &StoreReconciler{}
@@ -64,7 +64,7 @@ func NewStoreReconciler(store database.Store,
6464
clock: clock,
6565
registerer: registerer,
6666
done: make(chan struct{}, 1),
67-
provisionNotifyCh: make(chan *database.ProvisionerJob, 100),
67+
provisionNotifyCh: make(chan database.ProvisionerJob, 10),
6868
}
6969

7070
reconciler.metrics = NewMetricsCollector(store, logger, reconciler)
@@ -117,11 +117,7 @@ func (c *StoreReconciler) Run(ctx context.Context) {
117117
case <-ctx.Done():
118118
return
119119
case job := <-c.provisionNotifyCh:
120-
if job == nil {
121-
continue
122-
}
123-
124-
err := provisionerjobs.PostJob(c.pubsub, *job)
120+
err := provisionerjobs.PostJob(c.pubsub, job)
125121
if err != nil {
126122
c.logger.Error(ctx, "failed to post provisioner job to pubsub", slog.Error(err))
127123
}
@@ -600,9 +596,13 @@ func (c *StoreReconciler) provision(
600596
return xerrors.Errorf("provision workspace: %w", err)
601597
}
602598

599+
if provisionerJob == nil {
600+
return nil
601+
}
602+
603603
// Publish provisioner job event outside of transaction.
604604
select {
605-
case c.provisionNotifyCh <- provisionerJob:
605+
case c.provisionNotifyCh <- *provisionerJob:
606606
default: // channel full, drop the message; provisioner will pick this job up later with its periodic check, though.
607607
c.logger.Warn(ctx, "provisioner job notification queue full, dropping",
608608
slog.F("job_id", provisionerJob.ID), slog.F("prebuild_id", prebuildID.String()))

0 commit comments

Comments
 (0)