Skip to content

Instantly share code, notes, and snippets.

@ordinaryzelig
Created June 28, 2013 18:53
Show Gist options
  • Save ordinaryzelig/5887093 to your computer and use it in GitHub Desktop.
Save ordinaryzelig/5887093 to your computer and use it in GitHub Desktop.

The story

  • given customer is on carpoolin.com/someurl/results/123
  • press a button, their Frontend sends it to their Backend, their frontend sends fare_id to SS and polls for the url
  • in the meanwhile the user will see 'their' waiting page
  • we return a url
  • their frontend redirects/blanks new page whatever our url (our waiting page)
  • as soon as we can we redirect/submit form with js to send the user to the agency

Proposed process

  1. user clicks purchase
  2. fare_id is sent to SearchService
  3. SS queues the job for BotQueen
  4. SS also makes a Redis key with the status of 'in_progress'
  5. BQ gets the job from the queue
  6. BQ uses SearchClient to request data from SS (segment, fare, etc.)
  7. SS handles this request, queries db, responds to BQ with results
  8. BQ sends info to bot
  9. bot constructs HTML, making requests to agency if necessary
  10. bot returns HTML to BQ
  11. BQ sets the key (previously created by SS in step 4) to the generated HTML

meanwhile, in the browser:

  1. browser polls for how to redirect user
  2. browser polls SS for HTML
  3. Each time SS is polled, SS asks Redis if HTML is available
  4. Poll until HTML is available
  5. HTML will redirect the user deep as possible into the payment process of the agency & ensure that the cookie is droped to track the sales
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment