Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Commit

Permalink
Lower in-memory cache time and return a warning about cached values (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sethvargo authored Mar 18, 2021
1 parent 0ec489b commit d22d61b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/controller/issueapi/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type Controller struct {

// New creates a new IssueAPI controller.
func New(cfg config.IssueAPIConfig, db *database.Database, limiter limiter.Store, smsSigner keys.KeyManager, h *render.Renderer) *Controller {
localCache, _ := cache.New(5 * time.Minute)
localCache, _ := cache.New(30 * time.Second)

return &Controller{
config: cfg,
Expand Down
4 changes: 4 additions & 0 deletions pkg/controller/realmadmin/settings_modify.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ func (c *Controller) HandleSettings() http.Handler {
controller.InternalError(w, r, c.h, err)
return
}

flash.Warning("It can take up to 5 minutes for the new SMS configuration to be fully propagated.")
}
}

Expand Down Expand Up @@ -408,6 +410,8 @@ func (c *Controller) HandleSettings() http.Handler {
controller.InternalError(w, r, c.h, err)
return
}

flash.Warning("It can take up to 5 minutes for the new email configuration to be fully propagated.")
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ func (db *Database) OpenWithCacher(ctx context.Context, cacher cache.Cacher) err
rawDB.Callback().Update().After("gorm:update").Register("purge_cache:realms:by_id", callbackPurgeCache(ctx, cacher, "realms:by_id", "realms", "id"))
rawDB.Callback().Delete().After("gorm:delete").Register("purge_cache:realms:by_id", callbackPurgeCache(ctx, cacher, "realms:by_id", "realms", "id"))

// Stats
rawDB.Callback().Update().After("gorm:update").Register("purge_cache:stats:key_server", callbackPurgeCache(ctx, cacher, "stats:realm:key_server_enabled", "key_server_stats", "realm_id"))
rawDB.Callback().Delete().After("gorm:delete").Register("purge_cache:stats:key_server", callbackPurgeCache(ctx, cacher, "stats:realm:key_server_enabled", "key_server_stats", "realm_id"))

Expand Down

0 comments on commit d22d61b

Please sign in to comment.