Execute Code After a Response is Returned?

Поделиться
HTML-код
  • Опубликовано: 24 ноя 2024

Комментарии • 37

  • @mrjoekneeland
    @mrjoekneeland 2 месяца назад +8

    I just learned 70 things in 14 minutes. Sweet new promo for laracasts at the end there. I'll be deferring tons. Thank you, Jeffrey and Laravel

  • @techsaralk
    @techsaralk 2 месяца назад +1

    Laravel is now my favourite framework.... 🔥

  • @QuintessentialDio
    @QuintessentialDio 2 месяца назад

    The outro is 🔥🔥

  • @antdonn
    @antdonn 2 месяца назад

    i’m working on a project, right now, this is magic !!

  • @ehsanwebent
    @ehsanwebent 2 месяца назад +1

    Very nice outro ❤‍🔥❤‍🔥❤‍🔥

  • @sam-j4zy
    @sam-j4zy 2 месяца назад

    I Learn new stuff today, thanks laracasts

  • @marcosaugustoschultzwutke6670
    @marcosaugustoschultzwutke6670 2 месяца назад

    Very good!!! I will use it in my applications. Thank you!

  • @ila6545
    @ila6545 2 месяца назад

    Wow! This is cool!

  • @dhawanj5592
    @dhawanj5592 2 месяца назад +1

    Jeff I will meet you once in life from India

  • @sanjaykm
    @sanjaykm 2 месяца назад +1

    Hi. In my Laravel app v-11.23.5 the defer is not working. My app migrated from version 10.23 to version 11 2 months ago.

  • @suikolaravel
    @suikolaravel 2 месяца назад +1

    So much knowledge to bite, delicious. but Where is the PHPStorm like usual

  • @gherosh
    @gherosh 2 месяца назад +4

    wonder what issues timeouts causes with this defer 🤔

  • @juanflores.director
    @juanflores.director 2 месяца назад

    Nice lets try it out

  • @sergeyagronov9650
    @sergeyagronov9650 2 месяца назад +1

    what happens if you have an exception in the defer callback? in queues at least you could re run failed jobs. what happens when you go pass 30 seconds limit for example in cloudflare?

    • @newtonjob7611
      @newtonjob7611 Месяц назад

      One of my biggest fears with running things after response is not being able to track failures.

  • @rayan_azzam
    @rayan_azzam Месяц назад

    Thank you for that, i just wonder how to make testing for this, i am using Pest and i am facing an error some thing like this
    PHP Fatal error: Uncaught Swoole\Error: API must be called in the coroutine in....
    any idea?

  • @monirulislamccr
    @monirulislamccr 2 месяца назад

    What about the status code define inside defer function? Will it execute the last response?

  • @nabeelyousafpasha
    @nabeelyousafpasha 2 месяца назад

    Respect from Pakistan

  • @ravenpk100
    @ravenpk100 2 месяца назад +1

    is defer a good use case for when deleting a row can cascade into deleting multiple rows like up to 10000 or a queue and job would be better for this?

    • @JohnnyBigodes
      @JohnnyBigodes 2 месяца назад +1

      If your project depends on it use the queue, otherwise use the defer.
      When something could go wrong and you need to retry, use always the queue.

  • @gidaban79
    @gidaban79 2 месяца назад

    Just wonder. How it will works with try catch, cashier and stripe ?

  • @hlorofos
    @hlorofos 2 месяца назад

    I suppose there is no guarantee this defer code will keep working for a long time in cloud setups, like Vapor? Lambda executor could be terminated and your defer code could end up with partial result, resulting in corrupted data.

    • @renatofrota
      @renatofrota 2 месяца назад +2

      the "guarantee" is the same as if the code were executed without the defer. so if your time executing limitations is 30s and the task could not be completed as a regular code (before sending response to user) it won't execute as deferred code as well. this function is to be used to speed up navigation (do not make user wait for the small tasks to be completed before rendering page if these tasks will take just a few ms/secs and the probability of the successful completion is [near] 100%)

  • @josephuisso244
    @josephuisso244 2 месяца назад

    What will happen when the user navigates to another page will defer function still executed?

    • @renatofrota
      @renatofrota 2 месяца назад +3

      the user's request results is already sent and the process is now running standalone, it has no clue what the user is doing on their end, so it keeps running no matter what the user does - unless you intentionally somehow "watch" for new incoming requests in the closure code your pass to the defer() function.

  • @Wolfci
    @Wolfci 2 месяца назад

    It would be awesome when explaining when to use defer or jobs is to give examples like hey use defer for these scenarios that you would use in web development and use jobs for these examples could be short and simple explanation

    • @renatofrota
      @renatofrota 2 месяца назад

      let's say you have a list of items, paginated. and on render, you have to process/calculate something. if this is time consuming, you can defer a pre-calculation for all entries in the next/previous pages of the current page the user is viewing (and save them in cache). this way, when user clicks prev/next button, the page will load instantly (and the next/prev one starts processing in background and so on).

  • @thavarajan1
    @thavarajan1 2 месяца назад

    How the database transaction behave?

  • @homamal289
    @homamal289 2 месяца назад

    Lol jeffery is dictionary like so much info in 13:59 amazing hope you give us an advanced laravel project like 30 day series

  • @عليالعصفوري-ط4ض
    @عليالعصفوري-ط4ض 2 месяца назад

    The first thing come to my mind is mail

    • @benshaw6209
      @benshaw6209 2 месяца назад +1

      But it's nice to have mail queued so that if there is a temporary problem with the mail server, you can rerun the queues.

  • @RaduStancaOnline
    @RaduStancaOnline 2 месяца назад

    Hold on a second, this looks like VS Code... 🤔🤔🤔🤔🤔

    • @CHSKnight
      @CHSKnight 2 месяца назад

      I believe it is.

  • @LucianoTonet
    @LucianoTonet 2 месяца назад

    Using Cursor? 👀

  • @samhk2222
    @samhk2222 2 месяца назад

    Wait a minute, what's that dump extension @ 1:07 ?