Inter request communication in Rails app

Hi,

Currently we are building an booking application using ROR with Postgres as backend and running over Puma. We have a requirement where user can purchase a slot to display their ads. Currently we are relaying on DB, if one user doing booking a slot then we are restricting other user to start booking for the same slot to avoid concurrency issues. Initially I thought to use redis but prior to that I want to inquiry that is there any concurrency framework where I can communicate between requests such that I can avoid DB dependency?

Can you restate this? I don't understand the problem you're trying to solve.

I certainly don't understand "avoiding dependency" on something you already have (and need) by adding yet another dependency.

Hi,

Sorry for the confusion. Currently, I solved (just avoided concurrency) issue by adding a status column to slot model. So when a user trying to purchase that slot I update status column to hold so that other user don’t able to book same slot at the same time.

Now I want solve the same problem without adding DB column. How can I do that?

Hope it clarifies.

Sorry for the confusion. Currently, I solved (just avoided concurrency) issue by adding a status column to slot model. So when a user trying to purchase that slot I update status column to hold so that other user don't able to book same slot at the same time.

Seems fine. Though didn't you need a field before to hold the booked/not-booked status of the slot? which could be "pending" as well?

Now I want solve the same problem without adding DB column.

Why? If the "status" is an attribute of the model, why would you *not* keep it in the DB?

It has to be persisted somewhere, and sure, you *could* use a key-value store like Redis but what is the point? Seems like an unnecessary complexity.

Hi

Actually there is no status column exists in slot model. I have added column for the sake of this functionality. Now, I want to know whether we can achieve same functionality without using any persistent storage?

No.