Skip to content

Commit

Permalink
Added minutes and seconds as available time units to express session …
Browse files Browse the repository at this point in the history
…expiry interval
  • Loading branch information
andsel committed Jun 3, 2023
1 parent 19be452 commit 410b145
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion broker/src/main/java/io/moquette/broker/config/IConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ public Duration durationProp(String propertyName) {
final char timeSpecifier = propertyValue.charAt(propertyValue.length() - 1);
final TemporalUnit periodType;
switch (timeSpecifier) {
case 's':
periodType = ChronoUnit.SECONDS;
break;
case 'm':
periodType = ChronoUnit.MINUTES;
break;
case 'h':
periodType = ChronoUnit.HOURS;
break;
Expand All @@ -98,7 +104,7 @@ public Duration durationProp(String propertyName) {
case 'w':
periodType = ChronoUnit.WEEKS;
break;
case 'm':
case 'M':
periodType = ChronoUnit.MONTHS;
break;
case 'y':
Expand Down
4 changes: 2 additions & 2 deletions distribution/src/main/resources/moquette.conf
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ password_file config/password_file.conf
# This option allows the session of persistent clients (those with clean session set to false) that are not
# currently connected to be removed if they do not reconnect within a certain time frame.
# This is a non-standard option in MQTT v3.1. MQTT v3.1.1 and v5.0 allow brokers to remove client sessions.
# The expiration period should be an integer followed by one of h d w m y for hour, day, week,
# month and year respectively. For example: 2m or 14d or 1y
# The expiration period should be an integer followed by one of s m h d w M y for seconds, minutes, hours, days, weeks,
# months and years respectively. For example: 2m or 14d or 1y
# default: infinite expiry
#*********************************************************************
# persistent_client_expiration 3d
Expand Down

0 comments on commit 410b145

Please sign in to comment.