server: Make the lag reconnect time configurable.

This commit is contained in:
Damir Jelić 2018-11-01 13:33:48 +01:00
parent b844a26c41
commit 0bc297ba94
2 changed files with 11 additions and 2 deletions

View file

@ -426,6 +426,16 @@ class MatrixConfig(WeechatConfig):
" Inactive users will be removed from the nicklist after a "
"day of inactivity."),
),
Option(
"lag_reconnect",
"integer",
"",
5,
604800,
"90",
("Reconnect to the server if the lag is greater than this "
"value (in seconds)"),
),
]
color_options = [

View file

@ -1317,8 +1317,7 @@ def matrix_timer_cb(server_name, remaining_calls):
server.lag_done = False
W.bar_item_update("lag")
# TODO print out message, make timeout configurable
if server.lag > 300000:
if server.lag > G.CONFIG.network.lag_reconnect * 1000:
server.disconnect()
return W.WEECHAT_RC_OK