Add job run cleaner (#2866)
* chore: remove duplicate import * feat: Add job run cleaner The new job cleans job runs older than a configured interval. Configure the job to clean jobs older than 1 minute.
This commit is contained in:
1 parent
bc332541c3
commit
55259029f1
5 files changed
+162
-5
No files matched your search
@@ -28,8 +28,8 @@ import (
|
||||
kmsjob "github.com/hashicorp/boundary/internal/kms/job"
|
||||
"github.com/hashicorp/boundary/internal/observability/event"
|
||||
"github.com/hashicorp/boundary/internal/plugin/host"
|
||||
hostplugin "github.com/hashicorp/boundary/internal/plugin/host"
|
||||
"github.com/hashicorp/boundary/internal/scheduler"
|
||||
"github.com/hashicorp/boundary/internal/scheduler/cleaner"
|
||||
"github.com/hashicorp/boundary/internal/scheduler/job"
|
||||
"github.com/hashicorp/boundary/internal/server"
|
||||
serversjob "github.com/hashicorp/boundary/internal/server/job"
|
||||
@@ -239,9 +239,9 @@ func New(ctx context.Context, conf *Config) (*Controller, error) {
|
||||
switch enabledPlugin {
|
||||
case base.EnabledPluginHostLoopback:
|
||||
plg := pluginhost.NewWrappingPluginClient(pluginhost.NewLoopbackPlugin())
|
||||
opts := []hostplugin.Option{
|
||||
hostplugin.WithDescription("Provides an initial loopback host plugin in Boundary"),
|
||||
hostplugin.WithPublicId(conf.DevLoopbackHostPluginId),
|
||||
opts := []host.Option{
|
||||
host.WithDescription("Provides an initial loopback host plugin in Boundary"),
|
||||
host.WithPublicId(conf.DevLoopbackHostPluginId),
|
||||
}
|
||||
if _, err = conf.RegisterHostPlugin(ctx, "loopback", plg, opts...); err != nil {
|
||||
return nil, err
|
||||
@@ -261,7 +261,7 @@ func New(ctx context.Context, conf *Config) (*Controller, error) {
|
||||
return nil, fmt.Errorf("error creating %s host plugin: %w", pluginType, err)
|
||||
}
|
||||
conf.ShutdownFuncs = append(conf.ShutdownFuncs, cleanup)
|
||||
if _, err := conf.RegisterHostPlugin(ctx, pluginType, client, hostplugin.WithDescription(fmt.Sprintf("Built-in %s host plugin", enabledPlugin.String()))); err != nil {
|
||||
if _, err := conf.RegisterHostPlugin(ctx, pluginType, client, host.WithDescription(fmt.Sprintf("Built-in %s host plugin", enabledPlugin.String()))); err != nil {
|
||||
return nil, fmt.Errorf("error registering %s host plugin: %w", pluginType, err)
|
||||
}
|
||||
}
|
||||
@@ -516,6 +516,9 @@ func (c *Controller) registerJobs() error {
|
||||
if err := kmsjob.RegisterJobs(c.baseContext, c.scheduler, c.kms); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := cleaner.RegisterJob(c.baseContext, c.scheduler, rw); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user