nexrender icon indicating copy to clipboard operation
nexrender copied to clipboard

getJob and resumeJob are practically duplicates

Open limzykenneth opened this issue 3 years ago • 2 comments

Describe the bug The two functions in nexrender-api are functionally identical in that they both retrieve a job and wrap them with an event emitter. They default method is GET and the content-type doesn't matter as the request does not have a body and they server always return JSON.

Information about environment

  • Which version of nexrender are you using? v1.38.0
  • What kind of the setup do you have? server+worker with API
  • Are you using pre-built binaries or globally installed npm packages? NPM package
  • Which kind (and version) of operating system you are running it in? Any
  • Any additional information that might be helpful

limzykenneth avatar Jul 31 '22 13:07 limzykenneth

Hey @limzykenneth, welcome back! :)

What would be your suggestion about that problem?

Also, I see that the original resumeJob was introduced by you: https://github.com/inlife/nexrender/commit/256b31bb78371c12a30ab5d15017a673c92cd119

inlife avatar Jul 31 '22 14:07 inlife

Was looking to do some updates recently and came across this.

I would suggest a deprecation message on getJob and make it an alias of resumeJob, although I wanted to add a new method to get a specific job by ID without the event emitter (like listJob but return only one by ID, which I'm doing manually for now) and getJob would be a fitting name for it, I'll need to think of something else.

limzykenneth avatar Aug 01 '22 01:08 limzykenneth

I'll make a PR for this according to proposal above in the next few days.

limzykenneth avatar Aug 23 '22 10:08 limzykenneth