Skip to content

Commit

Permalink
perf(clustering): validate fields only
Browse files Browse the repository at this point in the history
### Summary

Skip full validation of entities and validate the fields only.

Before:
```
[clustering] received updated configuration from control plane: 17291 ms
```

After:
```
[clustering] received updated configuration from control plane: 11213 ms
```

Signed-off-by: Aapo Talvensaari <[email protected]>
  • Loading branch information
bungle committed Oct 2, 2023
1 parent c092db7 commit f6402e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kong/clustering/protocol.lua
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ local function validate_entity(schema, entity)
if ws_id then
entity.ws_id = nil
end
local ok, errors = schema:validate_insert(entity)
local ok, errors = schema:validate_fields(entity)
if not ok then
local err_t = kong.db.errors:schema_violation(errors)
error(tostring(err_t))
Expand Down
3 changes: 3 additions & 0 deletions kong/db/schema/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2471,6 +2471,9 @@ function Schema.new_subschema(self, key, definition)
end


Schema.validate_fields = validate_fields


function Schema.define(tbl)
return setmetatable(tbl, {
__call = function(t, arg)
Expand Down

0 comments on commit f6402e8

Please sign in to comment.