-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webui: separate search results by job ids #170
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments on the coding style. I will leave the core functionality review to Kirk
}); | ||
|
||
Meteor.publish(Meteor.settings.public.SearchResultsCollectionName, function search_results_publication({ | ||
visibleTimeRange, | ||
fieldToSortBy, | ||
visibleSearchResultsLimit | ||
}) { | ||
if ((!currentServerStateList[this.userId]) || !(currentServerStateList[this.userId].jobID)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ((!currentServerStateList[this.userId]) || !(currentServerStateList[this.userId].jobID)) { | |
if (null === currentServerStateList[this.userId] || undefined === currentServerStateList[this.userId].jobID) { |
We should make explicit comparison rather than using !
if ((MyCollections[Meteor.settings.public.SearchResultsCollectionName] !== undefined) && | ||
(MyCollections[Meteor.settings.public.SearchResultsCollectionName]._name === collectionName)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ((MyCollections[Meteor.settings.public.SearchResultsCollectionName] !== undefined) && | |
(MyCollections[Meteor.settings.public.SearchResultsCollectionName]._name === collectionName)) { | |
if (undefined !== MyCollections[Meteor.settings.public.SearchResultsCollectionName] && | |
collectionName === MyCollections[Meteor.settings.public.SearchResultsCollectionName]._name) { |
We should try to keep the rvalue on the lhs
const [resultHighlightRegex, numSearchResultsOnServer, timeline] = useTracker(() => { | ||
if ((!serverState) || !(serverState.jobID)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ((!serverState) || !(serverState.jobID)) { | |
if ((null === serverState) || (undefined === serverState.jobID)) { |
@@ -534,10 +533,12 @@ async def cancel_metadata_task(task, pending_tasks, query_done_event): | |||
query_done_event.clear() | |||
|
|||
|
|||
# FIXME: only clear specific job in meta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this inline comment to the function body and mark it as TODO
?
if ((MyCollections[sessionId] !== undefined) && | ||
(MyCollections[sessionId][Meteor.settings.public.SearchResultsCollectionName]._name === collectionName)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ((MyCollections[sessionId] !== undefined) && | |
(MyCollections[sessionId][Meteor.settings.public.SearchResultsCollectionName]._name === collectionName)) { | |
if (undefined !== MyCollections[sessionId] && | |
collectionName === MyCollections[sessionId][Meteor.settings.public.SearchResultsCollectionName]._name) { |
@@ -109,33 +117,43 @@ const SearchView = () => { | |||
findOptions["sort"] = sort; | |||
} | |||
|
|||
if ((!serverState) || !(serverState.jobID)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ((!serverState) || !(serverState.jobID)) { | |
if (null === serverState || undefined === serverState.jobID) { |
I am not sure if it is possible for serverState.jobID
to be null
as well
timeline = timelineDoc; | ||
// FIXME: add job id | ||
const metaDoc = SearchResultsMetadataCollection.findOne({_id: `meta-job-${serverState.jobID}`}); | ||
if (metaDoc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (metaDoc) { | |
if (null !== metaDoc) { |
@@ -604,7 +624,7 @@ const SearchResultsTable = ({ | |||
} | |||
|
|||
let result = searchResult[columnName]; | |||
if (typeof(result) === "object") { | |||
if (typeof (result) === "object") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the space here?
@@ -88,6 +88,7 @@ class WebUiQueryHandlerWebsocket { | |||
case ServerMessageType.QUERY_STARTED: | |||
if (SearchState.WAITING_FOR_QUERY_TO_START === currentServerStateList[this.__sessionId].state) { | |||
currentServerStateList[this.__sessionId].state = SearchState.QUERY_IN_PROGRESS; | |||
currentServerStateList[this.__sessionId].jobID = message['value']['jobID'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentServerStateList[this.__sessionId].jobID = message['value']['jobID'] | |
currentServerStateList[this.__sessionId].jobID = message['value']['jobID']; |
const timelineDoc = MyCollections[Meteor.settings.public.SearchResultsMetadataCollectionName].findOne({_id: "timeline"}); | ||
if (timelineDoc) { | ||
timeline = timelineDoc; | ||
// FIXME: add job id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use TODO
instead?
Closing this as refactoring changes has been proposed and being PR'ed at #250 . |
References
Kirk reported that race conditions in search results and/or metadata were discovered when the server was undergoing high load.
Description
results_${job_id}
.job_id
as part of the state reporting back to the meteor server, which is later propagated to the meteor client side.results_${job_id}
and metadata fromresults-metadata
's documentmeta-job-${job_id}
.Validation performed
Manual integration test. Steps include:
clp-package
.clp-package
.http://localhost:4000
and start a search query.http://localhost:4000
, effectively emulating another user visiting the same site. Start a search query.