Merge pull request #10969 from thalesmg/refactor-gcp-pubsub-on-stop-v50
refactor(gcp_pubsub): always cleanup resources when calling `on_stop`
This commit is contained in:
commit
4e9eeb489d
|
@ -134,17 +134,21 @@ on_start(
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec on_stop(resource_id(), state()) -> ok | {error, term()}.
|
-spec on_stop(resource_id(), state()) -> ok | {error, term()}.
|
||||||
on_stop(
|
on_stop(ResourceId, _State) ->
|
||||||
ResourceId,
|
?tp(gcp_pubsub_stop, #{resource_id => ResourceId}),
|
||||||
_State = #{jwt_config := JWTConfig}
|
|
||||||
) ->
|
|
||||||
?tp(gcp_pubsub_stop, #{resource_id => ResourceId, jwt_config => JWTConfig}),
|
|
||||||
?SLOG(info, #{
|
?SLOG(info, #{
|
||||||
msg => "stopping_gcp_pubsub_bridge",
|
msg => "stopping_gcp_pubsub_bridge",
|
||||||
connector => ResourceId
|
connector => ResourceId
|
||||||
}),
|
}),
|
||||||
emqx_connector_jwt:delete_jwt(?JWT_TABLE, ResourceId),
|
ok = emqx_connector_jwt:delete_jwt(?JWT_TABLE, ResourceId),
|
||||||
ehttpc_sup:stop_pool(ResourceId).
|
case ehttpc_sup:stop_pool(ResourceId) of
|
||||||
|
ok ->
|
||||||
|
ok;
|
||||||
|
{error, not_found} ->
|
||||||
|
ok;
|
||||||
|
Error ->
|
||||||
|
Error
|
||||||
|
end.
|
||||||
|
|
||||||
-spec on_query(
|
-spec on_query(
|
||||||
resource_id(),
|
resource_id(),
|
||||||
|
|
Loading…
Reference in New Issue