Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 3364399

Browse files
authored
Avoid hanging up requests when message queue is fulled. (#365)
1 parent 01b155e commit 3364399

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/sky_module.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ void sky_request_flush(zval *response, uint64_t request_id) {
202202
boost::interprocess::open_only,
203203
s_info->mq_name
204204
);
205-
mq.send(msg.data(), msg.size(), 0);
205+
if (!mq.try_send(msg.data(), msg.size(), 0)) {
206+
sky_log("sky_request_flush message_queue is fulled");
207+
}
206208
} catch (boost::interprocess::interprocess_exception &ex) {
207209
sky_log("sky_request_flush message_queue ex" + std::string(ex.what()));
208210
php_error(E_WARNING, "%s %s", "[skywalking] open queue fail ", ex.what());

0 commit comments

Comments
 (0)