Create Lead gives: "Server was too busy to process this request. Please try again."

The DB seems to be locking on getting the series from the DB:

mysql > show processlist;

MariaDB [_2b626a0ea886b6db]> show full processlist;
+-----+-------------------+-----------------+-------------------+---------+------+------------+----------------------------------------------------------------------------+----------+
| Id  | User              | Host            | db                | Command | Time | State      | Info                                                                       | Progress |
+-----+-------------------+-----------------+-------------------+---------+------+------------+----------------------------------------------------------------------------+----------+
|  35 | root              | localhost       | _2b626a0ea886b6db | Query   |    0 | starting   | show full processlist                                                      |    0.000 |
| 421 | _2b626a0ea886b6db | localhost:48256 | _2b626a0ea886b6db | Query   |   16 | Statistics | SELECT `current` FROM `tabSeries` WHERE `name`='CRM-LEAD-2022-' FOR UPDATE |    0.000 |
+-----+-------------------+-----------------+-------------------+---------+------+------------+----------------------------------------------------------------------------+----------+
2 rows in set (0.000 sec)

I’ve disabled all other hooks related to the Lead but still getting this.

Seems to be solved with a lock timeout extension

set innodb_lock_wait_timeout=100;

Source mysql Lock wait timeout exceeded; try restarting transaction - Database Administrators Stack Exchange

This should not be a problem if you don’t have simultaneous leads being generated. You should check the recorder to figure out what is happening during the saving. Saving can’t be this slow to lock for so many seconds.