Skip to content

Commit

Permalink
improve cache purge (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakthom committed Apr 21, 2023
1 parent cb2ed3d commit d712c78
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.15.3
v0.15.4
3 changes: 2 additions & 1 deletion cmd/buz/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ func (a *App) initializeSchemaCacheRoutes() {
r := a.manifold.GetRegistry()
if a.config.Registry.Purge.Enabled {
log.Info().Msg("🟢 initializing schema registry cache purge route")
a.switchableRouterGroup.GET(a.config.Registry.Purge.Path, registry.PurgeCacheHandler(r))
a.switchableRouterGroup.GET(registry.CACHE_PURGE_ROUTE, registry.PurgeCacheHandler(r))
a.switchableRouterGroup.POST(registry.CACHE_PURGE_ROUTE, registry.PurgeCacheHandler(r))
}
if a.config.Registry.Http.Enabled {
log.Info().Msg("🟢 initializing schema registry routes")
Expand Down
4 changes: 2 additions & 2 deletions deploy/terraform/aws/lambda/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ variable "buz_domain" {
}

variable "buz_version" {
description = "The version of Buz to run. \n\nExample: v0.15.3"
description = "The version of Buz to run. \n\nExample: v0.15.4"
type = string
default = "v0.15.3"
default = "v0.15.4"
}

variable "buz_lambda_memory_limit" {
Expand Down
2 changes: 1 addition & 1 deletion deploy/terraform/gcp/cloud_run/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ gcp_project = "my-project-23456"
gcp_region = "us-central1"
system = "buz"
buz_domain = "track.yourdomain.com"
buz_version = "v0.15.3"
buz_version = "v0.15.4"
```
4 changes: 2 additions & 2 deletions deploy/terraform/gcp/cloud_run/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ variable "buz_domain" {
}

variable "buz_version" {
description = "The version of Buz to run. \n\nExample: v0.15.3"
description = "The version of Buz to run. \n\nExample: v0.15.4"
type = string
default = "v0.15.3"
default = "v0.15.4"
}

variable "buz_service_timeout_seconds" {
Expand Down
2 changes: 1 addition & 1 deletion examples/quickstart/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ x-dependency:
services:
buz:
container_name: buz
image: ghcr.io/silverton-io/buz:v0.15.3
image: ghcr.io/silverton-io/buz:v0.15.4
volumes:
- type: bind
source: ./buz/quickstart.conf.yml
Expand Down
3 changes: 1 addition & 2 deletions pkg/config/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ type Http struct {
}

type Purge struct {
Enabled bool `json:"enabled"`
Path string `json:"path"`
Enabled bool `json:"enabled"`
}

type Backend struct {
Expand Down
1 change: 1 addition & 0 deletions pkg/registry/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func PurgeCacheHandler(r *Registry) gin.HandlerFunc {
fn := func(c *gin.Context) {
log.Debug().Msg("🟡 schema cache purged")
r.Cache.Clear()
c.JSON(200, response.CachePurged)
}
return gin.HandlerFunc(fn)
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/registry/param.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package registry

const (
SCHEMAS_ROUTE = "/s/"
SCHEMA_PARAM = "schema"
SCHEMAS_ROUTE = "/s/"
CACHE_PURGE_ROUTE = "/c/purge"
SCHEMA_PARAM = "schema"
)
4 changes: 4 additions & 0 deletions pkg/response/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ var SchemaNotAvailable = Response{
Message: "schema not available",
}

var CachePurged = Response{
Message: "cache purged",
}

var Timeout = Response{
Message: "request timed out",
}
Expand Down
8 changes: 1 addition & 7 deletions schemas/io.silverton/buz/internal/config/app/v1.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -746,17 +746,11 @@
"type": "boolean",
"default": "false",
"description": "Whether or not to enable schema cache purge endpoints"
},
"path": {
"type": "string",
"default": "/c/purge",
"description": "The path by which to purge the schema cache"
}
},
"additionalProperties": false,
"required": [
"enabled",
"path"
"enabled"
]
},
"http": {
Expand Down

0 comments on commit d712c78

Please sign in to comment.