Skip to content
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

Receiving Files in jobbr-server should be completely async (migrated) #10

Open
michaelschnyder opened this issue Mar 27, 2017 · 0 comments
Milestone

Comments

@michaelschnyder
Copy link
Member

originally filed by @michaelschnyder on Apr 4, 2015 on the old repo


The jobbr server receives multiple files as multipart data.

See: https://github.com/jobbrIO/jobbr-execution-forked/blob/develop/source/Jobbr.Server.ForkedExecution/BackChannel/ForkedExecutionController.cs#L97

IEnumerable<HttpContent> parts = this.Request.Content.ReadAsMultipartAsync().Result.Contents;

The implementation is not straight forward and should be refactored to used async. Because it can block under certain situations.

It should be something like

public async Task<IHttpActionResult> AddArtefact(long jobRunId) 
{ 
    var streamProvider = await this.Request.Content.ReadAsMultipartAsync(); 
    foreach (var file in streamProvider.Contents) 
    { 
        var content = await file.ReadAsByteArrayAsync(); 
        /* Your Code here */ 
    } 
    return this.Ok(); 
}
@olibanjoli olibanjoli added this to the vNext milestone Apr 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants