Skip to content

Login and wait for asynchronous sync transactions to complete #7

@massover

Description

@massover

When a user logs in and we kick off an aysnchronous celery task
Then the user should see Loading until the task is complete
And then the user should be redirected to /recurring-transactions

In synchronous server side templating land, we can accomplish this by:

  • redirecting the user to a different route(eg, /login/sync-transactions)
  • the template will have a loading icon
  • the template contains javascript which just polls the sync-transaction endpoint until it returns a complete state
  • when the state is complete, it does a javascript redirects /recurring-transactions

In asynchronous land, we can accomplish this by:

  • we create a different /login endpoint that returns a 200/401 on success/failure.
  • upon success we update the dom with the loader
  • when the state of the 'task' model to changes from pending -> complete, we redirect to /recurring-transactions

The behavior is broken right now because it immediately redirects without waiting for the task to complete.

The task must be an asynchronous worker because it could take longer than 30 seconds to complete and heroku times out web requests after 30 seconds.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions