-
Notifications
You must be signed in to change notification settings - Fork 4
Story/cite 132 1 #267
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
base: develop
Are you sure you want to change the base?
Story/cite 132 1 #267
Conversation
[CITE-132] merging develop to update the branch to latest
Can one of the admins verify this patch? |
jobRepo.save(job); | ||
|
||
Future<String> result = new AsyncResult<String>(job.getId()); | ||
return result; |
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.
merge with line 170
if (existingFuture != null && !existingFuture.isDone()) { | ||
existingFuture.cancel(true); | ||
futureMap.remove(groupId); | ||
} |
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 is the job cancelled here?
return result; | ||
} | ||
|
||
private boolean checkIfThreadIsInterrupted(Thread thread, GroupSyncJob job, String groupId) { |
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.
this does not only check but also set the task to cancelled
job.setStatus(JobStatus.PREPARED); | ||
jobRepo.save(job); | ||
jobManager.addJob(job); | ||
Thread currentThread = Thread.currentThread(); |
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.
I think you can just do this in checkIfThreadIsInterrupted
and remove the first parameter of the method.
|
||
syncCitations(user, groupId, job, versions, counter); | ||
|
||
if(checkIfThreadIsInterruptedAndCancelJob(job, groupId)) { |
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.
Actually, now that I'm looking at this again, you will want to cancel the thread within the syncCitations
and probably also syncCollections
method. They are the long running methods that need to be cancelled if cancellation was requested. Otherwise, if there are 1000 citations to sync it would still go through all of them before cancelling.
|
||
private boolean checkIfThreadIsInterruptedAndCancelJob(GroupSyncJob job, String groupId) { | ||
Thread thread = Thread.currentThread(); | ||
if(thread.isInterrupted()) { |
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.
merge with 173
@Override | ||
public void cancelJob(String jobId) { | ||
Optional<GroupSyncJob> jobOptional = jobRepo.findById(jobId); | ||
String groupId; |
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.
declare where needed
Make it so, Jenkins. |
Jenkins successfully deployed Citesphere to be reviewed! |
Not sure why, but the items table for a group is now empty. |
Jenkins successfully deployed Citesphere to be reviewed! |
|
Jenkins successfully deployed Citesphere to be reviewed! |
Guidelines for Pull Requests
If you haven't yet read our code review guidelines, please do so, You can find them here.
Please confirm the following by adding an x for each item (turn
[ ]
into[x]
).Please provide a brief description of your ticket
... Put ticket description here and add link to ticket ...
Right now, a job is just marked as cancelled (for jobs that silently failed) but not aborted. The sync processor should check in regular intervals if the current job is still in progress or if it should be cancelled.
https://diging.atlassian.net/browse/CITE-132
Are there any other pull requests that this one depends on?
Here is the previous PR: #212
Anything else the reviewer needs to know?
... describe here ...