mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
record sleeping threads
This commit is contained in:
@@ -48,6 +48,11 @@ public class MetricsBean {
|
|||||||
thisMinute.statusesInserted += statusesCount;
|
thisMinute.statusesInserted += statusesCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void threadWaited() {
|
||||||
|
thisHour.threadWaited++;
|
||||||
|
thisMinute.threadWaited++;
|
||||||
|
}
|
||||||
|
|
||||||
public Metric getLastMinute() {
|
public Metric getLastMinute() {
|
||||||
return lastMinute;
|
return lastMinute;
|
||||||
}
|
}
|
||||||
@@ -61,6 +66,7 @@ public class MetricsBean {
|
|||||||
private int feedsUpdated;
|
private int feedsUpdated;
|
||||||
private int entriesInserted;
|
private int entriesInserted;
|
||||||
private int statusesInserted;
|
private int statusesInserted;
|
||||||
|
private int threadWaited;
|
||||||
|
|
||||||
public int getFeedsRefreshed() {
|
public int getFeedsRefreshed() {
|
||||||
return feedsRefreshed;
|
return feedsRefreshed;
|
||||||
@@ -94,5 +100,13 @@ public class MetricsBean {
|
|||||||
this.statusesInserted = statusesInserted;
|
this.statusesInserted = statusesInserted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getThreadWaited() {
|
||||||
|
return threadWaited;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThreadWaited(int threadWaited) {
|
||||||
|
this.threadWaited = threadWaited;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.commafeed.backend.MetricsBean;
|
||||||
import com.commafeed.backend.HttpGetter.NotModifiedException;
|
import com.commafeed.backend.HttpGetter.NotModifiedException;
|
||||||
import com.commafeed.backend.model.Feed;
|
import com.commafeed.backend.model.Feed;
|
||||||
import com.commafeed.backend.model.FeedEntry;
|
import com.commafeed.backend.model.FeedEntry;
|
||||||
@@ -39,6 +40,9 @@ public class FeedRefreshWorker {
|
|||||||
@Inject
|
@Inject
|
||||||
FeedPushInfoService feedPushInfoService;
|
FeedPushInfoService feedPushInfoService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
MetricsBean metricsBean;
|
||||||
|
|
||||||
public void start(MutableBoolean running, String threadName) {
|
public void start(MutableBoolean running, String threadName) {
|
||||||
log.info("{} starting", threadName);
|
log.info("{} starting", threadName);
|
||||||
|
|
||||||
@@ -58,6 +62,7 @@ public class FeedRefreshWorker {
|
|||||||
update(feed);
|
update(feed);
|
||||||
} else {
|
} else {
|
||||||
log.debug("sleeping");
|
log.debug("sleeping");
|
||||||
|
metricsBean.threadWaited();
|
||||||
Thread.sleep(15000);
|
Thread.sleep(15000);
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user