You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2020/12/11 15:13:29 UTC
[skywalking-python] branch master updated: Fix:
queue.get(block=False) can raise Empty (#99)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-python.git
The following commit(s) were added to refs/heads/master by this push:
new 3d90e1e Fix: queue.get(block=False) can raise Empty (#99)
3d90e1e is described below
commit 3d90e1e007c1019da0614a7620859878c8a59fb3
Author: Tomasz Pytel <to...@gmail.com>
AuthorDate: Fri Dec 11 12:13:20 2020 -0300
Fix: queue.get(block=False) can raise Empty (#99)
---
skywalking/agent/protocol/grpc.py | 7 +++++--
skywalking/agent/protocol/http.py | 7 +++++--
skywalking/agent/protocol/kafka.py | 7 +++++--
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/skywalking/agent/protocol/grpc.py b/skywalking/agent/protocol/grpc.py
index f5468a4..4207070 100644
--- a/skywalking/agent/protocol/grpc.py
+++ b/skywalking/agent/protocol/grpc.py
@@ -18,7 +18,7 @@
import logging
from skywalking.loggings import logger
import traceback
-from queue import Queue
+from queue import Queue, Empty
import grpc
@@ -70,7 +70,10 @@ class GrpcProtocol(Protocol):
def report(self, queue: Queue, block: bool = True):
def generator():
while True:
- segment = queue.get(block=block) # type: Segment
+ try:
+ segment = queue.get(block=block) # type: Segment
+ except Empty:
+ return
logger.debug('reporting segment %s', segment)
diff --git a/skywalking/agent/protocol/http.py b/skywalking/agent/protocol/http.py
index 331f71a..89d43bf 100644
--- a/skywalking/agent/protocol/http.py
+++ b/skywalking/agent/protocol/http.py
@@ -16,7 +16,7 @@
#
from skywalking.loggings import logger
-from queue import Queue
+from queue import Queue, Empty
from skywalking.agent import Protocol
from skywalking.client.http import HttpServiceManagementClient, HttpTraceSegmentReportService
@@ -41,7 +41,10 @@ class HttpProtocol(Protocol):
def report(self, queue: Queue, block: bool = True):
def generator():
while True:
- segment = queue.get(block=block) # type: Segment
+ try:
+ segment = queue.get(block=block) # type: Segment
+ except Empty:
+ return
logger.debug('reporting segment %s', segment)
diff --git a/skywalking/agent/protocol/kafka.py b/skywalking/agent/protocol/kafka.py
index 8e6e75a..3eabfdb 100644
--- a/skywalking/agent/protocol/kafka.py
+++ b/skywalking/agent/protocol/kafka.py
@@ -17,7 +17,7 @@
import logging
from skywalking.loggings import logger, getLogger
-from queue import Queue
+from queue import Queue, Empty
from skywalking import config
from skywalking.agent import Protocol
@@ -45,7 +45,10 @@ class KafkaProtocol(Protocol):
def report(self, queue: Queue, block: bool = True):
def generator():
while True:
- segment = queue.get(block=block) # type: Segment
+ try:
+ segment = queue.get(block=block) # type: Segment
+ except Empty:
+ return
logger.debug('reporting segment %s', segment)