Tom Morris are those on that wired article?
Actually, I don’t want to know.
Tom Morris are those on that wired article?
Actually, I don’t want to know.
I just faked having a task queue for #taproot #indieweb note posting tasks using Symfony HttpKernel::terminate()
and it was the easiest thing ever.
Instances or subclasses of HttpKernel
have a terminate($request, $response)
method which, if called in the front controller after $response->send();
triggers a kernel.terminate
event on the app’s event dispatcher. Listeners attached to this event carry out their work after the content has been sent to the client, making it the perfect place to put time-consuming things like POSSE and webmention sending.
Once you’ve created your new content and it’s ready to be sent to the client, create a new closure which carries out all the the time consuming stuff and attach it as a listener to your event dispatcher, like this:
$dispatcher->addListener('kernel.terminate', function() use ($note) {
$note = sendPosse($note);
sendWebmentions($note);
$note->save();
}
Then, provided you’re calling $kernel->terminate($req, $res);
in index.php, your callback will get executed after the response has been sent to the client.
If you’re not using HttpKernel and HttpFoundation, the exact same behaviour can of course be carried out in pure PHP — just let the client know you’ve finished sending content and execute code after that. Check out these resources to learn more about how to do this:
fastcgi_finish_request()
flush()
HttpFoundation\Request::send()
as a sample implementationFurther ideas: if the time consuming tasks alter the content which will be shown in any way, set a header or something to let the client side know that async stuff is happening. It could then re-fetch the content after a few seconds and update it.
Sure, this isn’t as elegant as a message queue. But as I showed, it’s super easy and portable, requiring the addition of three or four lines of code.
@benwerd nice one! I’m currently working on video post-by-email. It almost worked here, next time should work flawlessly.
The nice thing about using email to post videos is that it’s asyncronous — I can send the email and then go do something else, instead of having to either wait for it to upload or do the “if I switch apps now will it stop uploading argh what do I do” dance.
Testing posting #indieweb videos via email and the iOS camera app:
Aw, the upload worked but embedding didn’t. Here it is:
Bookmarklet of the day: jsgif for giving GIFs controls. Pause, skip, reverse — it’s all there and not too slow either!
Congratulations to all my friends who got into university, and congratulations too to those who decided to take a different path. You’re all awesome :)
Having fun with tour.golang.org/#35
@thatEmil woah, huge possibility for profound-sounding statments right there :)
Aaaand… I bought my @dConstruct ticket! Now this will act as incentive to organise the rest of the trip. As if @indiewebcampuk wasn’t enough already :)
Bit bummed I had to sign up for Google Wallet to pay, but hey.
Aral Balkan there’s been a lot of discussion recently about deletion of #indieweb content — some documented here: indiewebcamp.com/deleted and indiewebcamp.com/POSSE#Delete
E.G. if I’ve replied to one of your notes/tweets and stored a reply context so even if your copy goes down my content still makes sense, but you delete the original — should I delete it, devaluing my own content? Should I mark it as changed or deleted?
MDN says FF has “implemented” the SVG text module, then goes on to list 13 presentation attributes which “don’t work”. How exactly does that count as implementing the module? Grr. This is why @supports
is doomed.
@seb_ly also kinda hilarious that they threaten to “print out” reposts. Tempted to alter my print styles to give them a little surprise…
Are there any languages with datatypes with built in version control? Would be pretty great for debugging.
Some of my favourite humour comes from the dissonance created when maths and dry, scientific language is used to analyse creative license. This is a classic example:
http://www.youtube.com/watch?v=muVfidujxRg
I love trying to introspect humour, attempting to articulate exactly what it is about something which makes it so funny. In this case I think it stems from the fact that the source material was intended to be passively consumed. At first, the presenter defies this intention by deconstructing the physics involved — a form of intense seeing.
This on its own might be moderately amusing, but instead of simply saying “this is not possible”, he actually acknowledges the original intention and assumes that it must be possible (“I saw it on TV, it must be true!”).
I think the humour here comes from the fact that, despite clearly having the skills to debunk the animation, he barely even acknowledges that he has that choice, and instead changes his own understanding of the show to make it fit (e.g. the ponies are made of dark matter).
Wikipedia article of the day: Pope Hilarius
Quick poll: “schedule” as “sked-you-ull” or “shed-you-ull”?
Aaron Parecki sssh! I got a good thing going on here :D