Skip to content

Commit 30963d7

Browse files
Merge pull request #54 from nlnwa/handle-worker-exceptions
Handle all crawl queue worker exceptions
2 parents b8f8565 + 361c259 commit 30963d7

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/main/java/no/nb/nna/veidemann/frontier/db/CrawlQueueWorker.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,11 @@ public void run() {
6767
if (moved > 0) {
6868
LOG.debug("{} CrawlExecutions moved from running state to timeout state", moved);
6969
}
70+
} catch (Exception e) {
71+
e.printStackTrace();
7072
} catch (Throwable t) {
71-
LOG.error("Error running chg queue manager script", t);
73+
t.printStackTrace();
74+
System.exit(1);
7275
}
7376
}
7477
};
@@ -93,8 +96,11 @@ public void run() {
9396
p.sync();
9497
LOG.debug("Deleted {} URIs from crawl queue", deleted);
9598
}
99+
} catch (Exception e) {
100+
e.printStackTrace();
96101
} catch (Throwable t) {
97-
LOG.error("Error running chg queue manager script", t);
102+
t.printStackTrace();
103+
System.exit(1);
98104
}
99105
}
100106
};
@@ -122,6 +128,11 @@ public void run() {
122128

123129
chgId = ctx.getJedis().lpop(CHG_TIMEOUT_KEY);
124130
}
131+
} catch (Exception e) {
132+
e.printStackTrace();
133+
} catch (Throwable t) {
134+
t.printStackTrace();
135+
System.exit(1);
125136
}
126137
}
127138
};
@@ -143,6 +154,9 @@ public void run() {
143154
}
144155
} catch (Exception e) {
145156
e.printStackTrace();
157+
} catch (Throwable t) {
158+
t.printStackTrace();
159+
System.exit(1);
146160
}
147161
}
148162
};
@@ -154,6 +168,11 @@ public void run() {
154168
frontier.getCrawlQueueManager().pause(DbService.getInstance().getExecutionsAdapter().getDesiredPausedState());
155169
} catch (DbException e) {
156170
LOG.warn("Could not read pause state", e);
171+
} catch (Exception e) {
172+
e.printStackTrace();
173+
} catch (Throwable t) {
174+
t.printStackTrace();
175+
System.exit(1);
157176
}
158177
}
159178
};
@@ -177,6 +196,11 @@ public void run() {
177196
LOG.warn("Could not update jobExecutionState", e);
178197
}
179198
});
199+
} catch (Exception e) {
200+
e.printStackTrace();
201+
} catch (Throwable t) {
202+
t.printStackTrace();
203+
System.exit(1);
180204
}
181205
}
182206
};

0 commit comments

Comments
 (0)