Python Pysnmp nextCmd超时随时间增加

Python Pysnmp nextCmd超时随时间增加,python,pysnmp,Python,Pysnmp,我正在使用pysnmp nextCmd定期(15秒)从变送器获取值 但是,在每个循环中完成请求所需的时间都在增加 from time import sleep, time from pysnmp.hlapi import * request_count = 0 while request_count < 100: t0 = time() snmp_response = [] for (errorIndication, errorStatus, errorInde

我正在使用pysnmp nextCmd定期(15秒)从变送器获取值 但是,在每个循环中完成请求所需的时间都在增加

from time import sleep, time
from pysnmp.hlapi import *


request_count = 0
while request_count < 100:
    t0 = time()
    snmp_response = []
    for (errorIndication, errorStatus, errorIndex, varBinds) in nextCmd(
        SnmpEngine(),
        UsmUserData(userName='transmitter_username', authKey='transmitter_authkey'),
        UdpTransportTarget((10.0.0.1, 161), timeout=1.0, retries=0),
        ContextData(),
        ObjectType(ObjectIdentity('1.3.6.1.2.1.1.1.0')),
        lexicographicMode=False
    ):
        if errorIndication or errorStatus:
            print(errorStatus)
            print(errorIndication)
        else:
            snmp_response.append(varBinds)

    t1 = time()
    print(t1-t0)
    sleep(3)
    request_count += 1

为什么它会随着时间而增加?我遗漏了什么吗?

可能是多线程交互问题?我无法用pysnmp 4.4.12重现这种效果,您的脚本在命令提示符下运行。我在web上检查了交互问题,但找不到任何相关信息。你能分享一个链接吗?我的意思是,如果我在一个线程环境中运行你的脚本,我就不能重现这个问题。这使我认为可能是您的应用程序是多线程的,并且pysnmp调用没有充分同步,导致计时器损坏。。。只是一个想法。
 1.1249938011169434
 1.1327455043792725
 2.132364273071289
 1.1966924667358398
 2.671931505203247
 1.12489914894104
 1.1628892421722412
 2.419915199279785
 1.993680477142334
 1.156675100326538
 2.601043939590454
 1.1927564144134521
 1.152949333190918
 1.3245742321014404
 3.4447848796844482
 2.326068878173828
 3.287410259246826
 1.2187728881835938
 2.5252578258514404
 3.5365397930145264
 4.069114685058594
 3.0139386653900146
 3.9634206295013428
 4.017256259918213