DelayQueue根本不工作,消息立即发送

时间:2018-03-16 13:27:17

标签: python python-3.x message-queue telegram-bot

我得到了一个简单的“你好!”消息发送者通过Telegram API,不遵守我把消息放入队列的消息限制。它应该每秒发送1条消息: burst_limit = 2,time_limit_ms = 2034

public class MonitorInterceptor {


@Advice.OnMethodEnter
static void enter(@Advice.Origin String method) throws Exception {

    System.out.println(method);

}

发现它根本没有延迟。所有消息都是立即发送的,不尊重 burst_limit time_limit_ms 参数(请查看下面日志中发送的消息时间):

new AgentBuilder.Default()
            .with(new AgentBuilder.InitializationStrategy.SelfInjection.Eager())
            .with(AgentBuilder.Listener.StreamWriting.toSystemError())
            .ignore(none())
            .type((ElementMatchers.nameContains("ThreadPoolExecutor")))
            .transform((builder, typeDescription, classLoader, module) -> builder
                    .constructor(ElementMatchers.any())
                    .intercept(Advice.to(MyAdvice.class))
                    .method(ElementMatchers.any())
                    .intercept(Advice.to(MonitorInterceptor.class))
            ).installOn(instrumentation);

可能发生什么或我忘记了什么?

0 个答案:

没有答案
相关问题