github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/internal/engine/session/controller.go (about)

     1  package session
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/tilt-dev/tilt/internal/controllers/core/session"
     7  	"github.com/tilt-dev/tilt/internal/store"
     8  )
     9  
    10  // A stub controller that simply schedules Session reconciliation whenever
    11  // the engine state changes.
    12  type Controller struct {
    13  	r *session.Reconciler
    14  }
    15  
    16  var _ store.Subscriber = &Controller{}
    17  
    18  func NewController(r *session.Reconciler) *Controller {
    19  	return &Controller{
    20  		r: r,
    21  	}
    22  }
    23  
    24  func (c *Controller) OnChange(ctx context.Context, st store.RStore, summary store.ChangeSummary) error {
    25  	if summary.IsLogOnly() {
    26  		return nil
    27  	}
    28  	c.r.Requeue()
    29  	return nil
    30  }