Commit 0db03b1
authored
[ServiceBus] Fix TTL on messages (Azure#21869)
Using `seconds` on `timedelta` to set TTL leads to unexpected behaviour with, for example, `timedelta(days=1)`:
```
azure.servicebus.exceptions.ServiceBusError: Argument TimeToLIve must be a positive timeout value. The provided value was 00:00:00.
Parameter name: TimeToLIve
Actual value was 00:00:00
```
Instead of `seconds`, `total_seconds()` should be used:
```
>>> timedelta(days=1).seconds
0
>>> timedelta(days=1).total_seconds()
86400.0
```1 parent 35d5436 commit 0db03b1
File tree
2 files changed
+9
-1
lines changed- sdk/servicebus/azure-servicebus
- azure/servicebus/_common
- tests
2 files changed
+9
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
356 | | - | |
| 356 | + | |
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
0 commit comments