Fastcgi help!

Something really weird happened with my app recently and i’m lost on
exactly happened.

I have a bunch of validations setup in my models to ensure that no
have identical columns within a certain date range. So user x can only
a blog entry to blog y once a month (example).

However, i saw that this validation failed on script that posts a bunch
entries all by the same user. So the db showed the same user posting to
same blog all within a few seconds of each other.

I looked at my access log and saw that there were 2 HTTP POSTs to the
controller at the same time that these duplicate entries got saved. I
this weird because i had the validations in place, and when i test on my
laptop i’m not able to recreate it. This made me think about fastcgi as
culprit. Could it be that 2 fastcgi processes go the request at the
time and independently validated the data? Meaning that when either
process did a read to validate, they both passed because neither had
committed the data yet.

Does this sound reasonable? If so, how would i go about guarding

Please, please help. Thanks in advance.

I think I’m seeing the same thing. I have a model, Member, that has:

validates_uniqueness_of :email

Yet, I have some non-unique emails. I’ve got a test that tries to create
members with the same email and it fails appropriately.

Any suggestions?



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs