database - Why can't one of my Rails processes see what the other has committed to the DB? -


i'm developing app on top of amazon fps. when make payment fps, payment succeeds asynchronously: make request , wait post (an instant payment notification) informing whether charge completed.

i need user see whether charge completed next page load (if possible), i'm having server:

  1. charge user, then
  2. spin in loop checking database status update, and
  3. time out if takes long

meanwhile, server process is:

  1. receiving ipn and
  2. noting success in database other process see.

i'm running unicorn 3 workers. they're logging same terminal window. see first process begin spin, reporting repeatedly charge still pending. see ipn come in, , second process pick , write database has succeeded. see first process continue see it's pending.

why never see success value written database?

it feels me transaction issue, ran separate process loops , outputs status of latest charge. when second process reported marked charge successful, third independent process agreed. it's first server process that's failing see updated value.

as far can tell, loop in first process not inside transaction, , shouldn't reading old snapshot. perhaps is? how tell?

my stack:

  • unicorn 4.6.3
  • rails 4.0
  • ruby 2.0
  • postgres 9.2


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -