Skip to content

Commit 10590bb

Browse files
committed
matching: don't let one FeedEntity's matching failure interrupt all others 🐛, add logging
1 parent 29edb2a commit 10590bb

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

lib/match.js

+21-8
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,28 @@ const createParseAndProcessFeed = (cfg) => {
116116
feedEntity,
117117
}, 'matching FeedEntity')
118118

119-
if (feedEntity.trip_update) {
120-
await matchTripUpdate(feedEntity.trip_update, {now})
121-
}
122-
if (feedEntity.vehicle) {
123-
await matchVehiclePosition(feedEntity.vehicle)
124-
}
125-
if (feedEntity.alert) {
126-
await matchAlert(feedEntity.alert)
119+
try {
120+
if (feedEntity.trip_update) {
121+
await matchTripUpdate(feedEntity.trip_update, {now})
122+
}
123+
if (feedEntity.vehicle) {
124+
await matchVehiclePosition(feedEntity.vehicle)
125+
}
126+
if (feedEntity.alert) {
127+
await matchAlert(feedEntity.alert)
128+
}
129+
} catch (err) {
130+
_logger.info({
131+
..._logCtx,
132+
error: err,
133+
feedEntitiesIdx,
134+
}, 'failed to match FeedEntity')
135+
return; // suppress errors, to let other parallel matchFeedEntity() calls keep running
127136
}
137+
_logger.trace({
138+
..._logCtx,
139+
feedEntitiesIdx,
140+
}, 'successfully matched FeedEntity')
128141
}
129142

130143
return runConcurrenctly(matchFeedEntity)

0 commit comments

Comments
 (0)