Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364831

Summary: More generic mechanism to use tasks only if necessary
Product: [ECD] Orion Reporter: Szymon Brandys <Szymon.Brandys>
Component: ClientAssignee: Malgorzata Janczarska <malgorzata.tomczyk>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: john.arthorne, malgorzata.tomczyk, tomasz.zarna
Version: unspecified   
Target Milestone: 0.4 M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Szymon Brandys CLA 2011-11-25 07:49:19 EST
Even usually short operations may last longer. This may be caused by a slow connection to a Git repo or problems with the net etc. We could run all operations as tasks, but there is another solution we already use for git operations. So if an operation is quick, we return immediately (200). If for any reason it is longer it becomes a task and 201 is returned. I think we should consider making this mechanism more generic as part of our .4 progress service work.
Comment 1 Malgorzata Janczarska CLA 2011-11-25 08:45:00 EST
An example for necessity for moving operations that didn't require tasks until now is  Bug 361006.
Comment 2 John Arthorne CLA 2011-11-25 10:00:14 EST
One small change I suggest: when the operation cannot complete immediately it should return 202 Accepted. Some links:

http://wiki.eclipse.org/Orion/Server_API#Progress_reporting
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.3
Comment 3 Tomasz Zarna CLA 2011-11-25 10:12:37 EST
(In reply to comment #0)
> [...] there is another solution we already use for git
> operations. So if an operation is quick, we return immediately (200). If for any
> reason it is longer it becomes a task and 201 is returned.

Afaik, this approach is only implemented when requesting Git Log. If it takes longer then expected 202 (HttpServletResponse.SC_ACCEPTED) is returned as John suggested in the last comment.
Comment 4 Szymon Brandys CLA 2011-11-25 10:26:55 EST
(In reply to comment #2)
> One small change I suggest: when the operation cannot complete immediately it
> should return 202 Accepted. Some links:
> 
> http://wiki.eclipse.org/Orion/Server_API#Progress_reporting
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.3

Yeah, I meant Accepted (202).

It would be cool, if we could use it transparently like we already do with authentication (at least server side, on the client side we still need to add the magic 'handle....AuthenticationError' line).
Comment 5 Tomasz Zarna CLA 2011-12-04 18:47:50 EST
We have to be careful with creating tasks for GET requests[1]. This doesn't sound RESTy[2].

[1] bug 365534
[2] See last paragraph of http://books.google.com/books?id=XUaErakHsoAC&lpg=PP1&pg=PA229#v=onepage&q&f=false
Comment 6 Malgorzata Janczarska CLA 2012-01-23 04:04:42 EST
Everything is migrated now.