Running cli command: sync_users.php causes system outage/locks database until finished

Running cli command: sync_users.php causes system outage/locks database until finished

by Sali Kaceli -
Number of replies: 2

We have about 10K accouns in Active Directory and run the cli command: sync_users.php every night at 4AM. However, some users are reporting that the system is not available during the time when this script is running. Error message: "Database error... " 

Is there any way to allow the script to run behind the scenes and also allow the users to login and use the system at the same time? 

Average of ratings: -
In reply to Sali Kaceli

Re: Running cli command: sync_users.php causes system outage/locks database until finished

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

That is a lot of accounts but it really shouldn't take the site down - that is not by design, I think that is an issue with your server or database resources/timeouts perhaps...I would start by checking your server for errors.

In reply to Sali Kaceli

Re: Running cli command: sync_users.php causes system outage/locks database until finished

by Enrico Preti -

all updates and additions of users are done in a single transaction, you can see that in the sync_users function in auth/ldap/auth.php. Maybe it is locking the user table and if someone is trying to login into moodle the locktimeout expire before it can update the user record with the last login info.