Dymantic / laravel-instagram-feed

150 stars 51 forks source link

refresh-feed doesn't work if run by laravel scheduler #52

Closed ascentcreative closed 2 years ago

ascentcreative commented 2 years ago

Hi,

I wonder if you can help me diagnose something.

Every few days, my client's IG feed starts returning 302 errors for the images in the feed. The page code only calls "feed" not "refresh" (to save loading times). So, I manually run "php artisan instagram-feed:refresh 200" and it fixes it, as expected.

However, I've set that command to also run in Laravel's scheduler:


$schedule->command('instagram-feed:refresh 200')
                    ->everyMinute()
                    ->emailOutputTo('me@mydomain.com');

        $schedule->command('instagram-feed:refresh-tokens')->monthly(); 

Both tasks show in php artisan schedule:list, and the refresh-tokens is working fine. For some reason, the feed refresh doesn't seem to work though (and I don't get any failure messages either). The feed starts returning 302 codes again, and I have to trigger the command manually to fix it.

Can you shed any light on why this might be?

michaeljoyner commented 2 years ago

Hi @ascentcreative, I'm not too sure what to suggest. I can't think of any reason why the command would work when called manually versus when called by the schedular. Do you see anything in your log file?

ascentcreative commented 2 years ago

Hi @michaeljoyner - thanks for the reply, much appreciated :)

No, there's nothing in the log at all. I'll try adding some debug output to the command and see if that gives any visibility of it.

Could the syntax for the parameter be an issue at all (just noticing that the token refresh which runs fine doesn't have a param).

ascentcreative commented 2 years ago

Oh man... it turned out to be a daft error in the the cron which runs the scheduler. Sorry to have bothered you...

The fact that the times and dates updated in schedule:list (and I was getting no errors from the cron side - /dev/null!) meant I misread what was going on.

Just needed a nudge in the right direction - thanks and sorry again!

michaeljoyner commented 2 years ago

Hey man, no bother at all, glad you figured it out. Thanks for letting me know.