Laravel served with Docker Compose via PHP FPM cache issue
Laravel app in Docker imports a daily CSV generated by SAP at 04:00. A server cron at 04:15 copies the file from an SMB-mounted path into the app container; a Laravel scheduled job runs at 04:30 to import it.
Despite logs confirming the new file was copied into the container at 04:15, the scheduled import sometimes reads the previous day’s file. The job’s logs show the previous file’s mtime/MD5. A manual Job re-run later (via tinker) imports the correct file without any new copy happening.
Initially I was replacing storage/app/import_files/orders.csv in place. I then changed to copying files with unique timestamped names and made the job pick the latest CSV by mtime to avoid fixed-filename and cache issues.
Unfortunately, the issue still occurs everyday. I’m looking for ideas on what could cause a scheduled job to see stale file contents/metadata inside Docker despite the file being present and verified via docker exec (stat/md5) before the job runs.
the scheduled import sometimes reads the previous day’s file
How exactly this scheduled tasks takes file to process? I mean, how "last file" is defined? By name, by modification time?
Can you chain two tasks and pass actual file name from first to second, so the processing task gets explicit file name without need to "find" it somehow?