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

Add migration documentation #15

Open
EECOLOR opened this issue Oct 17, 2018 · 0 comments
Open

Add migration documentation #15

EECOLOR opened this issue Oct 17, 2018 · 0 comments

Comments

@EECOLOR
Copy link
Member

EECOLOR commented Oct 17, 2018

This might help to get started:

require('firebase-queue') -> require('@kaliber/firebase-queue')

remove spec related database logic

const specCreated = specsRef.child(specId).set({
    in_progress_state: 'in_progress',
    finished_state: 'finished',
    error_state: 'error',
    timeout: TIMEOUT,
    retries: 0
  }).catch(reportError)

change queue instantiation:

  • it's a single object argument
  • spec is passed as option, don't forget to rename spec properties
  • numWorkers is 1 by default
  • timeout and retries are removed (see motivation)
  • rename task handler to processTask
  • add reportError
const options = { specId, numWorkers: 1 }
new Queue({ tasksRef, specsRef }, options, handleRequest)
const spec = {
    inProgressState: 'in_progress',
    finishedState: 'finished',
    errorState: 'error',
}
new Queue({ tasksRef, options: { spec }, processTask, reportError })

adjust process task function

  • adjust signature
  • return promise (if relevant)
  • remove calls to resolve and reject

function processTask(data, progress, resolve, reject) -> function processTask(data, { setProgress })

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

1 participant