Skip to content

Commit

Permalink
(+semver:patch) only run garbage collection if in memory is false
Browse files Browse the repository at this point in the history
  • Loading branch information
k-grant committed Oct 13, 2020
1 parent aeb2538 commit 9009d55
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/kvetch/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ func main() {

apiv1.RegisterAPIServer(server, service)

garbageCollector := services.NewGarbageCollectorService(kvstore, settings.GarbageCollectionInterval)

ctx, cancel := context.WithCancel(context.Background())
group, ctx := errgroup.WithContext(ctx)

group.Go(grpc.HostServer(ctx, server, settings.Port))
group.Go(grpc.HostMetrics(ctx, settings.PrometheusPort))
group.Go(garbageCollector.Run(ctx))

if !settings.KVStoreOptions.InMemory.GetValue() {
garbageCollector := services.NewGarbageCollectorService(kvstore, settings.GarbageCollectionInterval)
group.Go(garbageCollector.Run(ctx))
}

eventChan := make(chan os.Signal)
signal.Notify(eventChan, syscall.SIGINT, syscall.SIGTERM)
Expand Down
2 changes: 2 additions & 0 deletions cmd/kvetch/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ func getKVStoreOptions() (*kvstore.KVStoreOptions, error) {
} else {
kvStoreOptions.InMemory = &wrappers.BoolValue{Value: inMemory}
}
} else {
kvStoreOptions.InMemory = &wrappers.BoolValue{Value: false}
}
enableTruncateString, ok := os.LookupEnv("ENABLE_TRUNCATE")
if ok {
Expand Down

0 comments on commit 9009d55

Please sign in to comment.