I am working on a Rails app that has a form that makes 1st party API requests to Odoo v12, where I have all of my data stored. When a user submits 2 forms simultaneously, if there's any delay in the API response (as few as .2 seconds), the server begins work on the other request, which is expected.
However, when the responses come back in the order they were made, rails assign the response to the request with an open connection. (For e.g. response 1 is being assigned to request 2, and response 2 is being assigned to request 1.)
Inspecting the request_ids confirms that this is what is happening. Example of created record IDs returning to the wrong request
res.partner create
Starting api call for res.partner on request 63f02dd4-8242-4043-9926-1e34133be2e1 at 1576616788523
[{:odoo_po=>"7643153000", :quickbooks_invoice_url=>"", :deal_name=>"Delete ME PLEASE", :deal_id=>"427759097", :reorder=>0, :company=>333, :sale_contact=>337, :submitted_by=>98, :approver=>119, :hubspot_id=>"427759097", :shipping_deadline=>"2020-01-07", :delivery_deadline=>"2020-01-13", :knitting_deadline=>"2020-01-03", :internal_notes=>"", "distributor_po"=>"14215", "kit_arrays"=>"1,85996,15578;2,15578,85996;"}]
sale_form.sale_form create
Starting api call for sale_form.sale_form on request 673fa655-907a-416f-8ed9-7c97d220fc0b at 1576616788650
18805 _
673fa655-907a-416f-8ed9-7c97d220fc0b51 ms api call for sale_form.sale_form on request 673fa655-907a-416f-8ed9-7c97d220fc0b
9067 _ 63f02dd4-8242-4043-9926-1e34133be2e1
680 ms api call for res.partner on request 63f02dd4-8242-4043-9926-1e34133be2e1
In the code above, the '9067' should be record_id associated with the sale_form.sale_form request(request_id 673fa655-907a-416f-8ed9-7c97d220fc0b), while the '18805' should be the record_id associated with the res.partner request(request_id 63f02dd4-8242-4043-9926-1e34133be2e1)
The code runs fine when forms are submitted more than a few seconds apart so I don't think it is an issue with the code I've written. Is this an issue with Rails/Puma/some other Gem? Or should I shift my focus towards how Odoo is handling the requests/responses?