Intermittent failure registering for course
I did some work for a client a while back having intermittent failures with users registering for courses. We don't have steps to reproduce, but our theory came down to the calls to Civi::cache
in civimoodle_civicrm_post
and civimoodle_civicrm_buildForm
. If two users register at the same time and both hit civimoodle_civicrm_post
before the first hits civimoodle_civicrm_buildForm
, then the cache will hold the info for the second.
We resolved the issue by better keying; replace 'moodle-courses'
with 'moodle-course-' . session_id()
. Alternatively, refactoring to use a static var should also work as both requests would have their own copy.