Skip to content

Commit

Permalink
[modify] add LOG_PRODUCER_SEND_TIME_ERROR
Browse files Browse the repository at this point in the history
[modify] force rebuild when SEND_TIME_ERROR
  • Loading branch information
shabicheng committed Jan 16, 2018
1 parent 0672831 commit 36673c2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/log_producer_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ log_producer_result LOG_PRODUCER_SEND_QUOTA_ERROR = 5;
log_producer_result LOG_PRODUCER_SEND_UNAUTHORIZED = 6;
log_producer_result LOG_PRODUCER_SEND_SERVER_ERROR = 7;
log_producer_result LOG_PRODUCER_SEND_DISCARD_ERROR = 8;
log_producer_result LOG_PRODUCER_SEND_TIME_ERROR = 9;

const char * log_producer_result_string[] = {
"LOG_PRODUCER_OK",
Expand All @@ -27,7 +28,8 @@ const char * log_producer_result_string[] = {
"LOG_PRODUCER_SEND_QUOTA_ERROR",
"LOG_PRODUCER_SEND_UNAUTHORIZED",
"LOG_PRODUCER_SEND_SERVER_ERROR",
"LOG_PRODUCER_SEND_DISCARD_ERROR"
"LOG_PRODUCER_SEND_DISCARD_ERROR",
"LOG_PRODUCER_SEND_TIME_ERROR"
};

const char * log_producer_level_string[] = {
Expand All @@ -47,6 +49,10 @@ int is_log_producer_result_ok(log_producer_result rst)

const char * get_log_producer_result_string(log_producer_result rst)
{
if ((int)rst < 0 || (int)rst >= sizeof(log_producer_result_string) / sizeof(char *))
{
return log_producer_result_string[1];
}
return log_producer_result_string[rst];
}

Expand Down
1 change: 1 addition & 0 deletions src/log_producer_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ extern log_producer_result LOG_PRODUCER_SEND_QUOTA_ERROR;
extern log_producer_result LOG_PRODUCER_SEND_UNAUTHORIZED;
extern log_producer_result LOG_PRODUCER_SEND_SERVER_ERROR;
extern log_producer_result LOG_PRODUCER_SEND_DISCARD_ERROR;
extern log_producer_result LOG_PRODUCER_SEND_TIME_ERROR;



Expand Down
2 changes: 1 addition & 1 deletion src/log_producer_sender.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void * log_producer_send_fun(apr_thread_t * thread, void * param)
lz4_log_buf * send_buf = send_param->log_buf;
#ifdef SEND_TIME_INVALID_FIX
uint32_t nowTime = time(NULL);
if (nowTime - send_param->builder_time > 600 || send_param->builder_time > nowTime)
if (nowTime - send_param->builder_time > 600 || send_param->builder_time > nowTime || error_info.last_send_error == LOG_SEND_TIME_ERROR)
{
_rebuild_time(send_param->log_buf, &send_buf);
send_param->builder_time = nowTime;
Expand Down

0 comments on commit 36673c2

Please sign in to comment.