diff options
author | chili-b <dexter.gaonshatford@gmail.com> | 2021-03-06 22:40:00 +0300 |
---|---|---|
committer | chili-b <dexter.gaonshatford@gmail.com> | 2021-03-08 21:04:24 +0300 |
commit | 4ab0a06f6e157d6b7922b7bab4c4718cd34c26a6 (patch) | |
tree | 05d6e3539044f9f0f1ba4e8509d7bcd725ef8716 /src | |
parent | a8dff594cd86154db77a57987b910b7fdaa5c9d6 (diff) |
FIX(grpc): Avoid hang when exceeding 100ms timeout
While working with gRPC I ran up against an issue where using the bidirectional streams results in the server freezing after some time. I believe this is the result of the 100ms timeout on the call to processEvents. I changed out the method to one recommended by the Qt docs when using a local loop, but I believe the core of the issue to be with the timeout. With this change applied, my server has been running for 5+ days without running into the issue (normal use) where previously the longest it ever lasted was 2 days.
Diffstat (limited to 'src')
-rw-r--r-- | src/murmur_grpcwrapper_protoc_plugin/main.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/murmur_grpcwrapper_protoc_plugin/main.cpp b/src/murmur_grpcwrapper_protoc_plugin/main.cpp index ea6e19112..e4bbc334c 100644 --- a/src/murmur_grpcwrapper_protoc_plugin/main.cpp +++ b/src/murmur_grpcwrapper_protoc_plugin/main.cpp @@ -143,7 +143,7 @@ public: }; stream.Write(response, callback(cb)); while (!processed) { - QCoreApplication::processEvents(QEventLoop::ExcludeSocketNotifiers, 100); + QCoreApplication::sendPostedEvents(); } return success; } @@ -157,7 +157,7 @@ public: }; stream.Read(&request, callback(cb)); while (!processed) { - QCoreApplication::processEvents(QEventLoop::ExcludeSocketNotifiers, 100); + QCoreApplication::sendPostedEvents(); } return success; } |