Skip to content

Commit 740a64d

Browse files
committed
Fixed invalid error message in scheduler when you have slow schedules and 10 threads
1 parent d930fa5 commit 740a64d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

include/scheduler/simple_scheduler.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,19 @@ namespace simple_scheduler {
138138

139139
void scheduler::watch_dog(int id) {
140140
schedule_queue_type::value_type instance;
141+
bool maximum_threads_reached = false;
141142
while (!stop_requested_) {
142143
try {
143144
try {
144145
instance = queue_.top();
145146
if (instance) {
146147
boost::posix_time::time_duration off = now() - (*instance).time;
147148
if (off.total_seconds() > 5) {
148-
if (thread_count_ < 10)
149+
if (thread_count_ < 10) {
149150
thread_count_++;
150-
if (threads_.threadCount() > thread_count_) {
151-
log_error(__FILE__, __LINE__, "Scheduler is overloading: " + str::xtos(instance->schedule_id) + " is " + str::xtos(off.total_seconds()) + " seconds slow");
151+
} else if (!maximum_threads_reached) {
152+
log_error(__FILE__, __LINE__, "Auto-scaling of scheduler failed (maximum of 10 threads reached) you need to manually configure threads to reasolve items running slow");
153+
maximum_threads_reached = true;
152154
}
153155
}
154156
}

0 commit comments

Comments
 (0)