|
30 | 30 | logger.setLevel(logging.WARNING)
|
31 | 31 | logger.addHandler(logging.NullHandler())
|
32 | 32 |
|
33 |
| -# timeout the restore process in 1 min if not finished |
| 33 | +# timeout the restore process in 110 seconds if not finished |
34 | 34 | # This is mostly to wait for interfaces to be created and up after system warm-reboot
|
35 | 35 | # and this process is started by supervisord in swss docker.
|
36 |
| -# It would be good to keep that time below routing reconciliation time-out. |
37 |
| -TIME_OUT = 60 |
| 36 | +# There had been devices taking close to 70 seconds to complete restoration, setting |
| 37 | +# default timeout to 110 seconds. |
| 38 | +DEF_TIME_OUT = 110 |
38 | 39 |
|
39 | 40 | # every 5 seconds to check interfaces states
|
40 | 41 | CHECK_INTERVAL = 5
|
@@ -189,13 +190,13 @@ def set_statedb_neigh_restore_done():
|
189 | 190 | # Once all the entries are restored, this function is returned.
|
190 | 191 | # The interfaces' states were checked in a loop with an interval (CHECK_INTERVAL)
|
191 | 192 | # The function will timeout in case interfaces' states never meet the condition
|
192 |
| -# after some time (TIME_OUT). |
193 |
| -def restore_update_kernel_neighbors(intf_neigh_map): |
| 193 | +# after some time (DEF_TIME_OUT). |
| 194 | +def restore_update_kernel_neighbors(intf_neigh_map, timeout=DEF_TIME_OUT): |
194 | 195 | # create object for netlink calls to kernel
|
195 | 196 | ipclass = IPRoute()
|
196 | 197 | mtime = monotonic.time.time
|
197 | 198 | start_time = mtime()
|
198 |
| - while (mtime() - start_time) < TIME_OUT: |
| 199 | + while (mtime() - start_time) < timeout: |
199 | 200 | for intf, family_neigh_map in intf_neigh_map.items():
|
200 | 201 | # only try to restore to kernel when link is up
|
201 | 202 | if is_intf_oper_state_up(intf):
|
|
0 commit comments