-
Notifications
You must be signed in to change notification settings - Fork 896
feat: add lifecycle.Executor to manage autostart and autostop #1183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
a145d6d
8f401ca
6d8f5fe
cfd0d1e
ce63810
579f362
6e88f67
2b1a383
f31588e
80e0581
d176478
bd97c1a
0931d25
faebe2e
abc0854
e53946a
364a27c
e96414f
b5bf50e
d37cc2b
d11f5d7
f6388b4
fd0f8a3
7b6f2e1
a7143bd
7d9b696
5cba737
7627372
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ type Options struct { | |
GoogleTokenValidator *idtoken.Validator | ||
SSHKeygenAlgorithm gitsshkey.Algorithm | ||
APIRateLimit int | ||
Ticker <-chan time.Time | ||
LifecycleTicker <-chan time.Time | ||
} | ||
|
||
// New constructs an in-memory coderd instance and returns | ||
|
@@ -75,10 +75,10 @@ func New(t *testing.T, options *Options) *codersdk.Client { | |
options.GoogleTokenValidator, err = idtoken.NewValidator(ctx, option.WithoutAuthentication()) | ||
require.NoError(t, err) | ||
} | ||
if options.Ticker == nil { | ||
ticker := time.NewTicker(time.Second) | ||
options.Ticker = ticker.C | ||
t.Cleanup(ticker.Stop) | ||
if options.LifecycleTicker == nil { | ||
ticker := make(chan time.Time) | ||
options.LifecycleTicker = ticker | ||
t.Cleanup(func() { close(ticker) }) | ||
} | ||
|
||
// This can be hotswapped for a live database instance. | ||
|
@@ -109,7 +109,7 @@ func New(t *testing.T, options *Options) *codersdk.Client { | |
ctx, | ||
db, | ||
slogtest.Make(t, nil).Named("lifecycle.executor").Leveled(slog.LevelDebug), | ||
options.Ticker, | ||
options.LifecycleTicker, | ||
) | ||
go lifecycleExecutor.Run() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this |
||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.