From 14c83f94666a2df062aa8edd1972acdcc91b5ad0 Mon Sep 17 00:00:00 2001 From: Ben Brooks Date: Fri, 20 Sep 2024 14:37:01 +0100 Subject: [PATCH] Remove DBOnlineCallback --- db/database.go | 5 ----- rest/server_context.go | 7 ------- 2 files changed, 12 deletions(-) diff --git a/db/database.go b/db/database.go index f21104ce96..a1e14c8338 100644 --- a/db/database.go +++ b/db/database.go @@ -149,7 +149,6 @@ type DatabaseContextOptions struct { UnsupportedOptions *UnsupportedOptions OIDCOptions *auth.OIDCOptions LocalJWTConfig auth.LocalJWTConfig - DBOnlineCallback DBOnlineCallback // Callback function to take the DB back online ImportOptions ImportOptions EnableXattr bool // Use xattr for _sync LocalDocExpirySecs uint32 // The _local doc expiry time in seconds @@ -354,10 +353,6 @@ func getServerUUID(ctx context.Context, bucket base.Bucket) (string, error) { return uuid.(string), err } -// Function type for something that calls NewDatabaseContext and wants a callback when the DB is detected -// to come back online. A rest.ServerContext package cannot be passed since it would introduce a circular dependency -type DBOnlineCallback func(dbContext *DatabaseContext) - // Creates a new DatabaseContext on a bucket. The bucket will be closed when this context closes. func NewDatabaseContext(ctx context.Context, dbName string, bucket base.Bucket, autoImport bool, options DatabaseContextOptions) (dbc *DatabaseContext, returnedError error) { cleanupFunctions := make([]func(), 0) diff --git a/rest/server_context.go b/rest/server_context.go index 347f9f3cae..b90d6108ac 100644 --- a/rest/server_context.go +++ b/rest/server_context.go @@ -1113,12 +1113,6 @@ func dbcOptionsFromConfig(ctx context.Context, sc *ServerContext, config *DbConf } } - // Create a callback function that will be invoked if the database goes offline and comes - // back online again - dbOnlineCallback := func(dbContext *db.DatabaseContext) { - sc.TakeDbOnline(base.NewNonCancelCtx(), dbContext) - } - oldRevExpirySeconds := base.DefaultOldRevExpirySeconds if config.OldRevExpirySeconds != nil { oldRevExpirySeconds = *config.OldRevExpirySeconds @@ -1299,7 +1293,6 @@ func dbcOptionsFromConfig(ctx context.Context, sc *ServerContext, config *DbConf UnsupportedOptions: config.Unsupported, OIDCOptions: config.OIDCConfig, LocalJWTConfig: config.LocalJWTConfig, - DBOnlineCallback: dbOnlineCallback, ImportOptions: *importOptions, EnableXattr: config.UseXattrs(), SecureCookieOverride: secureCookieOverride,