SqsProducer allows invalid delay
aldenw opened this issue · 1 comments
aldenw commented
AWS for delay allows only whole seconds, and so SqsProducer is taking the milliseconds provided by the interface and dividing by 1000, like this
$arguments['DelaySeconds'] = (int) $this->deliveryDelay / 1000;
Because here the casting to int happens before the division, deliveryDelay of 500 will result in $arguments['DelaySeconds'] as a float of .5, and cause an error when received by AWS.
I think the casting to int was probably intended for the result of the division. So adding a parentheses I think is the fix. Probably also it would be best to do a ceil here.
I've made a pr for those changes here
#1266