tuitionio

tuitionio

Member Since 4 Years Ago

Experience Points 2,475
Experience Level 1

2,525 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 28
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

17 Jul
3 years ago

tuitionio left a reply on Laravel 5.1 - Change Log Filename

I think it failed because I put it into a folder called Loggers instead of using Bootstrap. Not sure why the hell that wouldn't work, but it didn't. I just changed it to Bootstrap. Maybe somewhere deep down that's what Laravel's expecting. No idea. But at least it works now.

tuitionio left a reply on Laravel 5.1 - Change Log Filename

Hmm, when I try your method I get this error when I hit any web page that uses Log class:

Fatal error: Uncaught exception 'ReflectionException' with message 'Class log does not exist' in /Users/me/Sites/myapp/vendor/laravel/framework/src/Illuminate/Container/Container.php:736

11 Jul
3 years ago

tuitionio started a new conversation Laravel Queue Failure Does Not Trigger Failed() Method If There's An Exception, But RaiseFailedJobEvent() Works

I am testing the queue functions in Laravel 5.1. I can make jobs queue up in my db table, called jobs, and I can get them to run successfully. I also created a queue failure table called failed_jobs. To test failures, inside the jobs table I manipulate the payload data to make it fail then I run the queue worker daemon like so, so it will put the job in the failed_jobs table after one failed attempt:

php artisan queue:work --daemon --tries=1 --queue=myqueue

When the job fails it is immediately put into failed_jobs table as expected.

I have registered my queue failure event in the AppServiceProvider's boot() method as outlined in the docs:

Queue::failing(function ($connection, $job, $data) { Log::error('Job failed!'); });

I have also tried the failed() method inside the actual job scripts like so:

/** * Handle a job failure. * * @return void */ public function failed() { Log::error('failed!'); }

Either way, neither of these events is triggered when the queued job fails. I see nothing in the logs except for the exception stack trace which I made occur on purpose when I corrupted the job payload data:

Stack trace: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'unserialize():

So I did some research. When a queue job failure occurs, the logic for handling that failure is in vendor/laravel/framework/src/Illuminate/Queue/Worker.php:

protected function logFailedJob($connection, Job $job) { if ($this->failer) { $this->failer->log($connection, $job->getQueue(), $job->getRawBody());

        $job->delete();

        $job->failed();

        $this->raiseFailedJobEvent($connection, $job);
    }

    return ['job' => $job, 'failed' => true];
}

What happens is the failed() function never executes (or it simply halts script execution) and it prevents the next function, raisedFailedJobEvent() from being called. Now if I reverse the order of these lines, I can get the raiseFailedJobEvent() to fire and if I register a queue event handler in EventServiceProvider.php or AppServiceProvider.php, I can verify it gets fired and I can successfully handle the event. Unfortunately, having failed() before raiseFailedJobEvent() prevents this event from ever occurring. The hack I have in place is reversing the order of these methods, which works, but obviously that sucks.

The real problem seems to stem from how I make it fail. If I deliberately corrupt the data in the job queue table, the failed() method never gets called, but like I said before the raiseFailedJobEvent() function does get called if put it before the failed() method in Worker.php.

If I actually go into vendor/laravel/framework/src/Illuminate/Queue/Worker.php and force it to fail every time it runs (in an exception-less way), then failure() gets called. The problem, obviously, is how do I know how this queue will behave in a real-world failure? If corrupt db data causes a failure yet prevents failure() from being called, this is no good. I can never alert my team. What if there is an actual corruption of db queue data in the real world?

08 Jul
3 years ago

tuitionio left a reply on Queue::failing Laravel 5

I am using Laravel 5. 1 and I can never get this event to occur, either via Queue::failing inside the boot() method of AppServiceProvider.php, or EventServiceProvider.php, or even by calling the failed() method inside the actual job classes. This just doesn't work at all. Yet the job does get placed into the failed_jobs table so I know that part works. Has anyone else seen this behavior in Laravel 5.1?