@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.

michael, to random
@michael@thms.uk avatar

I once again come to the conclusion that I hate gardening.

The fact that the previous owners of this house have planted not one, not two, but three big hedges doesn’t help.

And the fact that I have bad hay fever and an even worse back is the cherry on top …

michael, to Laravel
@michael@thms.uk avatar

So, it really annoyed me that in Laravel 11 you cannot have multiple listeners for the same event in an array like you could in Laravel 10.

It's not like it's a big deal, as it's simple enough to implement, but just seems like a step backwards.

What do you think?

https://blog.thms.uk/2024/05/event-listeners-laravel-11?utm_source=mastodon

#Laravel #PHP

michael,
@michael@thms.uk avatar

@stefanzweifel yeah, not a big fan of auto discovery either.

It just makes events way too opaque, in my opinion.

michael,
@michael@thms.uk avatar

@stefanzweifel yep. Had exactly the same issue …

michael,
@michael@thms.uk avatar

@outofcontrol it does require further optimisation at deploy time, if that’s what you mean.

That is part of artisan optimize though, so if you are already using that you don’t need to do anything else.
@stefanzweifel

michael,
@michael@thms.uk avatar
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.

michael,
@michael@thms.uk avatar

@emd I've just created this function in my AppServiceProvider. A bit silly that I now need to do this manually, imo, but not a big deal I suppose 🤷‍♂️

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 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! #php #disasterrecovery #emergencies

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 #phpstorm getting worse by the day?

I'm runnig 2024.1 (Build #PS-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... #fail #ensh11n

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

michael,
@michael@thms.uk avatar

@zf2timo tried that. Still having the same issues 😩 @theseer

mobileatom, to php
@mobileatom@flipboard.com avatar

New Proposed Array Find Functions in PHP 8.4. #PHP

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 …

michael, to random
@michael@thms.uk avatar

I've been getting this popup in my for the last couple of days.

Obviosuly I know why this is happening (NextDNS blocking the request) but I can't see any other info, such as which component is making that call, which URL is actually being requested etc.

Nor is there a way to stop this (clicking 'Reject' just makes the thing pop back up a few seconds later).

Anyone got any advice?

Thanks

michael, to random
@michael@thms.uk avatar

🤔 don’t drink that early in the morning, Duo!

michael, to Marriage
@michael@thms.uk avatar

One of the hardest parts of being married is when the OH wakes you up in the middle of the night because she ‘heard something downstairs’ and is now convinced there’s someone in the house.

Spoiler alert: there never is!

michael,
@michael@thms.uk avatar

The worst part though is that after you have checked the house, and inevitably found that there is of course no intruder (I’m genuinely not sure what I’d do if there ever was one, by the way. I’m no American, so there are no weapons in the house 🤷‍♂️) your body involuntarily goes on high alert, and for the next half hour every tiny sounds sends the adrenaline rushing, preventing me from falling asleep again, despite knowing full well that there is still no intruder 🙄🙄🙄

jan, to mastodon
@jan@kcore.org avatar

Yeah, I'd call this a problem somewhere. #nofiles open files of the mastodon user, which just runs mastodon.

#mastoadmin #mastodon

michael,
@michael@thms.uk avatar

@mick
Thanks for this. Very helpful!
@jan @paul @derek @haploc

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