Client hangs after a file:scan command is run server side

Greetings…

Nextcloud version (eg, 20.0.5): 20.0.8.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 18.04.5 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.29 (Ubuntu)
PHP version (eg, 7.4): 7.4.16

The issue you are facing:

I understand that this is probably ill-advised, but for my current setup I have a bash script that removes some files from the data directory of the user (nextcloud/data/$user/files/…) and then runs sudo -u www-data php /var/www/html/nextcloud/occ files:scan $user to synchronize these changes so the files are also deleted from the user’s local folder.

This used to work flawlessly up until the new Desktop client was released, both Windows and Linux clients.

With 3.2.x releases if I remove a file server side and run the scan the client hangs and is unable to synchronize again. It gets stuck “Waiting” forever.

This gets further exacerbated by the compulsory auto update mechanism that was built into the clients, basically forcing everybody to update and breaking our current setup for all our users.

Is this actually the desired behavior? Is there a better way to interact with the files server side? Is this some kind of weird bug?

Thanks!