Skip to content

Commit

Permalink
chore: remove useless judge in pubsub init (#7686)
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyDluffy6017 authored Aug 16, 2022
1 parent d1d4a64 commit 21dc9d5
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions apisix/core/pubsub.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,11 @@ local function init_pb_state()
-- initialize protoc compiler
protoc.reload()
local pubsub_protoc = protoc.new()

-- compile the protobuf file on initial load module
-- ensure that each worker is loaded once
if not pubsub_protoc.loaded["pubsub.proto"] then
pubsub_protoc:addpath("apisix/include/apisix/model")
local ok, err = pcall(pubsub_protoc.loadfile, pubsub_protoc, "pubsub.proto")
if not ok then
pubsub_protoc:reset()
return "failed to load pubsub protocol: " .. err
end
pubsub_protoc:addpath("apisix/include/apisix/model")
local ok, err = pcall(pubsub_protoc.loadfile, pubsub_protoc, "pubsub.proto")
if not ok then
pubsub_protoc:reset()
return "failed to load pubsub protocol: " .. err
end

pb_state = pb.state(nil)
Expand Down

0 comments on commit 21dc9d5

Please sign in to comment.