You need to sign in or sign up before continuing.
Fix race condition on multiple bill creation
While testing the split modes with personal parts, I sometimes encountered the problem that when multiple bills were created, some owers got assigned two times to one bill and the some bills were created with no ower at all (see attached image of the bill list after a page reload). I think this was due to a race condition when the ID of the inserted bill is fetched by selecting the maximum ID in the table. This could lead to to the situation that the simultaneous requests from JS all use the ID of the same (last) bill created instead of the one actually created during that request. It seems that using getLastInsertId()
to explicitly get the last ID inserted by the current connection fixes this issue.
Edited by klonfish