Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在为 URL 请求创建重试机制。如果我在 10 秒后没有得到蚂蚁回答,我想再次发送请求。问题是如何处理对前一个请求的响应,以防它在超过 10 秒后收到?
我假设您正在使用URLLoader以发送 http 请求。加载器有一个close方法。将它放在try-catch中很重要,并且删除侦听器也很好。这样即使有延迟的响应,你也不会得到它。但最好是调用close并删除听众:)
URLLoader
close