Skip to content

Commit

Permalink
Merge pull request #950 from Annopaolo/woah-trigger-policy-ttl-is-in-…
Browse files Browse the repository at this point in the history
…seconds

Trigger Engine: trigger policy TTLs are seconds, not milliseconds!
  • Loading branch information
davidebriani authored May 27, 2024
2 parents 912b5cd + 54dc227 commit fac70ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ defmodule Astarte.TriggerEngine.AMQPConsumer.AMQPMessageConsumer do
}) do
[]
|> put_x_arg_if(maximum_capacity != nil, {"x-max-length", :signedint, maximum_capacity})
|> put_x_arg_if(event_ttl != nil, {"x-message-ttl", :signedint, event_ttl})
# AMQP message TTLs are in milliseconds!
|> put_x_arg_if(event_ttl != nil, {"x-message-ttl", :signedint, event_ttl * 1_000})
end

defp put_x_arg_if(list, true, x_arg), do: [x_arg | list]
Expand Down
2 changes: 1 addition & 1 deletion doc/pages/architecture/062-trigger_delivery_policies.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ A Trigger Delivery Policy is composed of:
This is optional, but required if the policy specifies at least one handler with retry strategy.

- Event TTL: in orer to further lower the space requirement of the event queue, events may be equipped with a TTL which specifies the amount of
milliseconds an event is retained in the event queue. When an event expires, it is discarded from the event queue, even if it has not been
seconds an event is retained in the event queue. When an event expires, it is discarded from the event queue, even if it has not been
delivered. This is optional.


Expand Down

0 comments on commit fac70ec

Please sign in to comment.