I used this function to keep files on remote server up-to-date. The server is Ubuntu 16.04.
In the first 2~3 hours, the function worked perfectly. Whenever I changed any file, it would sync to remote within 2 seconds. But after several hours, say 4 or more, the delay might be 10 seconds or more. And at the same time, Winscp GUI was also very slow to response any operation, like stop/minimized. I had to restart winscp and the function, and after that the sync would become fast again.
The local folder contained 22 sub-dirs and about 64 files.
I saw lots of messages like 'Change in "folder name" detected', not sure if it is related to this issue.