inotify – Inotifywait not detecting new files while long script is executed

I am trying to monitor file creation with inotifiwait and execute a long script on every file creation.
Everything works smoothly when a single file is created but whenever i try to add two files at the same timle in this monitored directory i got the script running only once.

I have tried this but not success

d="path/dir/path/"
inotifywait -m  -e  create --format '%f' "${d}" | while read FILENAME
do
    
    IFS='-' read -r -a action <<< $FILENAME
    if  [ ${action[0]} = "dothing" ]

    then 

     HERE THE VERY LONG SCRIPT 
    fi 
done