Compare commits

...

5 Commits

Author SHA1 Message Date
id f26a2357d8 Merge remote-tracking branch 'origin/release-57' into sync-release-57-20240725-021830 2024-07-25 02:18:30 +00:00
Thales Macedo Garitezi c728b98e79
Merge pull request #13510 from thalesmg/20240723-r57-fix-jwt-about-to-expire-check
fix(jwt): fix grace period for renewal check
2024-07-24 16:52:35 -03:00
Thales Macedo Garitezi 9e65e0d048
Merge pull request #13503 from thalesmg/20240722-r57-resource-manager-hc-interval-startup
fix(connector resource): use configuration `resource_opts` for health check interval when starting up
2024-07-24 09:15:47 -03:00
Thales Macedo Garitezi 7374123c5c fix(jwt): fix grace period for renewal check 2024-07-23 17:25:29 -03:00
Thales Macedo Garitezi 8ae54ac325 fix(connector resource): use configuration `resource_opts` for health check interval when starting up
Fixes https://emqx.atlassian.net/browse/EMQX-12738
2024-07-22 11:34:10 -03:00
4 changed files with 7 additions and 4 deletions

View File

@ -141,5 +141,5 @@ store_jwt(#{resource_id := ResourceId, table := TId}, JWT) ->
is_about_to_expire(JWT) ->
#jose_jwt{fields = #{<<"exp">> := Exp}} = jose_jwt:peek(JWT),
Now = erlang:system_time(seconds),
GraceExp = Exp - timer:seconds(5),
GraceExp = Exp - 5,
Now >= GraceExp.

View File

@ -352,8 +352,10 @@ safe_atom(Bin) when is_binary(Bin) -> binary_to_existing_atom(Bin, utf8);
safe_atom(Atom) when is_atom(Atom) -> Atom.
parse_opts(Conf, Opts0) ->
Opts1 = override_start_after_created(Conf, Opts0),
set_no_buffer_workers(Opts1).
Opts1 = emqx_resource:fetch_creation_opts(Conf),
Opts2 = maps:merge(Opts1, Opts0),
Opts = override_start_after_created(Conf, Opts2),
set_no_buffer_workers(Opts).
override_start_after_created(Config, Opts) ->
Enabled = maps:get(enable, Config, true),

View File

@ -125,7 +125,7 @@ t_ensure_jwt(_Config) ->
JWT0 = emqx_connector_jwt:ensure_jwt(JWTConfig),
?assertNot(is_expired(JWT0)),
%% should refresh 5 s before expiration
ct:sleep(Expiration - 5500),
ct:sleep(Expiration - 3000),
JWT1 = emqx_connector_jwt:ensure_jwt(JWTConfig),
?assertNot(is_expired(JWT1)),
%% fully expired

View File

@ -0,0 +1 @@
Fixed an issue where a connector wouldn't respect the configured health check interval when first starting up, and would need an update/restart for the correct value to take effect.