Giter Site home page Giter Site logo

async-requests's People

Contributors

alanhala avatar alebian avatar dependabot[bot] avatar icoluccio avatar leamotta avatar leoncalermo avatar mdesanti avatar sbalay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

async-requests's Issues

Job name

Right now the sidekiq console shows 'AsyncRequest::JobProcessor' and you cannot see which worker failed

screen shot 2017-11-15 at 10 55 04

Add secure compare to job id

In the endpoint that shows a job's status, the id should be compared using a comparison method that prevents a timing attack.

Delete finished job in show action

Currently, the async_request_jobs table gets bigger and bigger with each async request. Since the client stops asking for a job once it is finished, it would be nice to have an automatic depuration in the table.

Another issue with the current behavior is that when you queue a job with a sensible parameter (like a password) it remains accessible for anyone that query the table.

I believe that this whole issue could be solved by performing a job destroy inside JobsController#show --> render_finished_job(job)

Confusing README

There are a couple of problems with the README file:

  • It says to simple call async_request but on the code example it does call for execute_async.
  • I needed to add include AsyncRequest::ApplicationHelper to my root controller.
  • It says that the second component of the array we are returning must respond to to_json. A simple String does that and it doesn't work.
  • it says status: 202 I would change that for status: :accepted
  • it uses MyComputeHeavyWorker and it says that uses Sidekiq to enqueue it, but actually MyComputeHeavyWorker its just a simple class and not a sidekiq worker.

Add support to nil response

When you use async_requests for making requests that depend on an external service’s response, you maybe want to do something like this:

class MyWorker
  def execute
    response = HTTParty.get('http://some-url.com/some_resource')

    [response.code, response.parsed_response]
  end
end

Here, you can expect that if the response code is 200, the response body will have data. But if the response code is 404, maybe the body will be empty.

It would be nice if the library can handle this kind of scenario, and replace a nil response with an empty hash {}. This way, it prevents from returning an Internal Server Error when the response body is empty.

Also, it would be nice if the README was corrected. In this case, a nil response responds to to_json.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.