@michael@thms.uk
@michael@thms.uk avatar

michael

@michael@thms.uk

Full stack web developer currently working mostly with #PHP / #Laravel, Vanilla #Javascript and #SCSS. Love learning more about (almost) anything, but particularly #MySQL and #InfoSec. Currently learning Arabic. Husband, father of two boys, Christian.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

emd, to Laravel
@emd@cosocial.ca avatar

What am I missing folks, you can't have multiple listeners (in an array) in v11?

https://laracasts.com/discuss/channels/laravel/laravel-11-register-event-with-multiple-listeners

michael,
@michael@thms.uk avatar

@emd yeah, I was looking at that earlier this week and thinking that’s a massive step backwards.

michael,
@michael@thms.uk avatar

@emd quite. I think autodiscovery for events isn’t great either to be honest.

Events already run the risk of stuff happening in opaque ways. This is gonna be even worse now.

Crell, to random
@Crell@phpc.social avatar

"It's a DTO so it shouldn't have methods, just data" is an excellent way to end up with procedural spaghetti with a class keyword floating around.

It certainly won't get you a good #OOP codebase, that's for sure.

michael,
@michael@thms.uk avatar

@Crell thank you for saying that. I have a number of DTOs with methods and sort of always feel kinda dirty about it, but also feel that the alternative would be worse …

sarah, to php
@sarah@phpc.social avatar

Do you rehearse your disaster recovery plans?

Have you ever stood up, from scratch, a completely new version of your application in a production-ready state?

If you haven't, you should.

You may never need to fully stand up a complete production instance, but what happens if a part goes down like your database, your webservers, or your jobs? Are you prepared for emergencies?

Practice makes perfect, especially in high-pressure situations. So practice!

michael,
@michael@thms.uk avatar

@sarah I had to do this some time last year. Proud to say: it only took us a few hours, in part because we had copious backups and had trained for this. 👍

theseer, to random
@theseer@phpc.social avatar

Is it just me or is getting worse by the day?

I'm runnig 2024.1 (Build -241.14494.237, built on March 27, 2024) but have to constantly restart the IDE to fix bizarre errors like PHPStorm claiming a property or parameter isn't used while highlighting the very use a line later, inconsistently resolving asserts with instanceof checks - e.g. claiming a method doesn't exist in the class referenced in a different assert and not seeing a parameter that is clearly there...

PHPStorm claiming a parameter is missing that is clearly there..

michael,
@michael@thms.uk avatar

@theseer yeah, I’m getting that so much lately. It’s becoming unbearable!

Often cutting and pasting the offending line(s) helps, and is obviously faster than a full quit and restart, but it is beyond annoying at this stage!

michael,
@michael@thms.uk avatar

@zf2timo might need to try that, I suppose @theseer

mobileatom, to php
@mobileatom@flipboard.com avatar

New Proposed Array Find Functions in PHP 8.4.

https://laravel-news.com/php-8-4-array-find-functions?utm_source=flipboard&utm_medium=activitypub

Posted into SYMFONY FOR THE DEVIL @symfony

michael,
@michael@thms.uk avatar

@mobileatom @symfony

I really do like it. But I still think it should be called array_first as that’s really what it is …

mick, to random
@mick@cosocial.ca avatar

For the first time the Mastodon server has started to struggle just a little bit to keep up with the flow of the Fediverse.

We’ve usually been “push” heavy but we’ve started to see some spikes in “pull” queue latency. The worst of these spikes was today, where we fell behind by at least a couple minutes for most of the afternoon.

1/?

A pair of graphs showing sidekiq queue latency and enqueued jobs. The queue latency peaked at around 6 minutes at roughly 6pm this afternoon, but was between 1-2 minutes most of the afternoon. The maximum number of messages in queue at any one time was 12000. The majority of the traffic is pull queue.

michael,
@michael@thms.uk avatar

@mick I haven’t read the entirety of the thread, so forgive me if that’s already been covered, but have you tried defining your workers with different sequences of queues.

So you could have one service defined as

/home/mastodon/.rbenv/shims/bundle exec sidekiq -c 10 -q pull -q default -q ingress -q push -q mailers

Another as

/home/mastodon/.rbenv/shims/bundle exec sidekiq -c 10 -q default -q ingress -q push -q mailers -q pull

Etc.

That wat you would have 10 workers prioritising the pull queue, but picking up other queues when capacity is available. And another 10 workers prioritising the default queue, but picking up other queues (including pull) when capacity is available.

You could permutate this for some different combination of queue priorities.

michael,
@michael@thms.uk avatar

@mick just to be clear, what I’d suggest is not to dedicate them, but to prioritise.

Maybe you mean the same thing, but if you set up a service with

/home/mastodon/.rbenv/shims/bundle exec sidekiq -c 10 -q pull

And another with

/home/mastodon/.rbenv/shims/bundle exec sidekiq -c 10 -q push

Then that first process will sit idle when there is nothing in the pull queue, even if the push queue might be full.

If, on the other hand, you have a service defined as

/home/mastodon/.rbenv/shims/bundle exec sidekiq -c 10 -q pull -q push

And another as

/home/mastodon/.rbenv/shims/bundle exec sidekiq -c 10 -q push -q pull

Then that first command will process the push queue, after the pull queue has been emptied. And the second one will process the pull queue after the push queue has been emptied. Thus potentially wasting fewer resources.

michael, to php
@michael@thms.uk avatar

Got to say: Just been through upgrading an app from 8.1 to 8.3 and it's really nice and painfree.

Very few breaking changes, and the few that are there are stuff that a sensible person would've addressed a long time ago.

Unfortuantely that means that apart from readonly classes, there are also few exciting new things in there. But I guess these also are just point updates after all…

Almost boring 😉 (Not a bad thing! Stability is also nice.)

michael,
@michael@thms.uk avatar

@joby yep. I’ve also done another site recently from 7.x to 8.1 that was originally built in 3.x.

Similarly painless. But, to be fair, that one is a far simpler site!

michael,
@michael@thms.uk avatar

@Crell yep I still got scars from when I upgraded my very first ever PHP application from 3 to 5. I was a kid when I started writing that app, so it definitely was full of stupid shit (still is, to be honest: always only ever stuck on band aids - the full rewrite is finally planned for later this year), so the upgrade was beyond hard.

But yeah, since then I’ve learned how to code properly (I think) so upgrades tend to be a lot simpler.

That first experience traumatised me for life though, so I’m still always scared when I start …

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • tacticalgear
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • Youngstown
  • everett
  • cisconetworking
  • slotface
  • GTA5RPClips
  • rosin
  • thenastyranch
  • kavyap
  • mdbf
  • Leos
  • modclub
  • osvaldo12
  • Durango
  • khanakhh
  • anitta
  • provamag3
  • ngwrru68w68
  • cubers
  • tester
  • ethstaker
  • megavids
  • normalnudes
  • lostlight
  • All magazines