senty

Member Since 5 Years Ago

Experience Points
38,385
Total
Experience

1,615 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
374
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

  • Community Pillar

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

Level 8
38,385 XP
Apr
09
1 month ago
Activity icon

Replied to What To Use With Multiple Api Calls Inside A Request

Thanks for all your inputs

Apr
04
1 month ago
Activity icon

Replied to What To Use With Multiple Api Calls Inside A Request

@bobbybouwmann thanks for you reply!

The data is based on user-input and so it's not really possible to cache (except identical user inputs).

I have a question about websockets. Is it a good idea to rely on web-sockets for the vital part of the application? May it cause some data not being delivered?

Activity icon

Started a new Conversation What To Use With Multiple Api Calls Inside A Request

I have a price-checker app that checks multiple 3rd party services and returns prices from them (think it like how Expedia checks a lot of 3rd party websites to return the prices).

Up until now, I've been using ajax and that's how I do the api-calls asynchronously. But as more services I add, I am thinking of if there is a better way to handle this.

With ajax I do:

let availableServices = [] // (comes from backend);

availableServiceIds.forEach(service => {
   axios.post(`rates/${service.id}`, requestData) // and show results simultaneously as they arrive
});

But it started making me think that ajax might not be the best solution for this because 1) I'm letting front-end knows the available services, 2) simultaneous ajax calls have limit (of 5 as I read)

I'm thinking of being able to make calls to up to 25 services at one time.

If I want to handle this logic fully on backend, how should I set this up?

So instead of ajax code above, I can add:

axios.post(`rates`, requestData)

and in my backend, I can act accordingly:

public function getRates() {
    $services = auth()->user()->availableServices;

    foreach ($services as $service) {
         // Here i need to somehow make calls to 3rd party services asynchronously
    }
}

The best way I can think of is:

  • I can create a queue worker called "rates" and do the api calls inside a job per service (so for loop above calls dispatches a job per service). And setup web-socket to deliver it back to the user. getRates() might return a total number of services (to understand when all rates fetching finished

(I've also seen spatie's async (https://github.com/spatie/async) but I couldn't make it work because my service classes are not simple ones, they are formed of multiple classes with bunch of logic and service providers. I think spatie's async is for smaller tasks. (so couldn't make it work)

If you'd want to setup a logic like that, how would you set this up?

There are 5000 users in the system and this is the vital part of the application. So maybe up to 100 users can do the action at the same time (resulting 25 api calls to 3rd party services by each user). That's why I am doubting about the queue and web-socket approach.

And the reason queue system seems logical was because I could spawn new queue worker servers just for "rating" and scale it on demand.

I'm really curious about the creative ways you'd solve this.