Skip to content

Commit

Permalink
handle unknown index types gracefully in iUtils
Browse files Browse the repository at this point in the history
this updates parseTaskId in iUtils.coffee which uses a somwhat strict
regular expression to parse a given task id and extract type,
datasource, and time.

this simply removes throwing the error and falls back to 'Unknown' for
type leaving dataSource and dataTime alone. in case of a match failure,
they would just default to undefined which isn't a blocker to render
/indexing-service view.
  • Loading branch information
alperkokmen committed Feb 23, 2018
1 parent 8bb88d2 commit 77575d7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/client/factories/iUtils.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ moment = require '../../../bower_components/moment/min/moment.min.js'

module.exports = ->
parseTaskId: (taskId) ->
m = taskId.match /^((hadoop_convert_segment)|index_(hadoop|realtime|spark)|(archive))_(.+)_(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z)/
type = m[3]
type ||= m[2]
throw Error("Can't parse #{taskId}") unless m
m = taskId.match /^((hadoop_convert_segment)|index_(hadoop|realtime|spark)|(archive))_(.+)_(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z)/ || []
{
id: taskId
type
type: m[3] || m[2] || 'Unknown'
dataSource: m[4]
dataTime: m[5]
}
Expand Down

0 comments on commit 77575d7

Please sign in to comment.