Skip to content

Commit

Permalink
[pfcwd] Use floor division in Python3 (sonic-net#1277)
Browse files Browse the repository at this point in the history
Fix the float division due to recent transfer to Python3, use floor division instead to generate integer result in the PFCWD detect/restore time calculation.

Signed-off-by: Longxiang Lyu <[email protected]>
  • Loading branch information
lolyu authored Dec 2, 2020
1 parent 24ffa25 commit a2728cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pfcwd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def start_default(self):
port_num = len(list(self.config_db.get_table('PORT').keys()))

# Paramter values positively correlate to the number of ports.
multiply = max(1, (port_num-1)/DEFAULT_PORT_NUM+1)
multiply = max(1, (port_num-1)//DEFAULT_PORT_NUM+1)
pfcwd_info = {
'detection_time': DEFAULT_DETECTION_TIME * multiply,
'restoration_time': DEFAULT_RESTORATION_TIME * multiply,
Expand Down

0 comments on commit a2728cb

Please sign in to comment.