Move the session cleanup job logic into the session package. (#2060)

* Move the session cleanup job logic into the session package.

This is part of a broader effort to more narrowly define the purpose of the internal/server directory to be for interacting with servers themselves.  Future changes will continue to remove things from this directory until the purpose of the directory is clearly working primarily with the boundary servers resource.
This commit is contained in:
Todd authored and GitHub committed 2022-05-05 10:29:30 -07:00
1 parent 780d913596
commit 687dd1bda6
8 files changed
+554 -582

No files matched your search

+1 -16
View File
@@ -357,28 +357,13 @@ func (c *Controller) registerJobs() error {
if err := pluginhost.RegisterJobs(c.baseContext, c.scheduler, rw, rw, c.kms, c.conf.HostPlugins); err != nil {
return err
}
if err := c.registerSessionConnectionCleanupJob(); err != nil {
if err := session.RegisterJobs(c.baseContext, c.scheduler, rw, c.conf.StatusGracePeriodDuration); err != nil {
return err
}
return nil
}
// registerSessionConnectionCleanupJob is a helper method to abstract
// registering the session connection cleanup job specifically.
func (c *Controller) registerSessionConnectionCleanupJob() error {
sessionConnectionCleanupJob, err := newSessionConnectionCleanupJob(c.ConnectionRepoFn, c.conf.StatusGracePeriodDuration)
if err != nil {
return fmt.Errorf("error creating session cleanup job: %w", err)
}
if err = c.scheduler.RegisterJob(c.baseContext, sessionConnectionCleanupJob); err != nil {
return fmt.Errorf("error registering session cleanup job: %w", err)
}
return nil
}
func (c *Controller) Shutdown() error {
const op = "controller.(Controller).Shutdown"
if !c.started.Load() {