Bluesky: Tasks are now done by workers #1399
No reviewers
Labels
No labels
2018.09
2019.01
2019.03
2019.06
2019.09
2019.12
2020.03
2020.06
2020.09
2020.12
2021.03
2021.07
2021.09
2022.02
2022.06
2022.09
2022.12
2023.04
2023.05
2023.09
2024.03
2024.06
2024.09
2024.12
dependencies
Hackathon 2021
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: friendica/friendica-addons#1399
Loading…
Reference in a new issue
No description provided.
Delete branch "heluecht/friendica-addons:bluesky-worker"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
All tasks that are executed by the "cron" hook are now done by spawned workers. This has got the improvement that there can be no blocking.
Also a lot more little improvements are now done. This ran for a couple of days without any problems. At this point nearly everything is implemented, with mostly only bugfixing left to do.
@ -11,1 +11,4 @@
*
* At some point in time:
* - Sending Quote shares https://atproto.com/lexicons/app-bsky-embed#appbskyembedrecord and https://atproto.com/lexicons/app-bsky-embed#appbskyembedrecordwithmedia
´*
Watch out for an extra Unicode character on this line.
Done
@ -118,3 +119,3 @@
}
$data = bluesky_get($pconfig['uid'], '/xrpc/app.bsky.actor.getProfile?actor=' . $did, HttpClientAccept::JSON, [HttpClientOptions::HEADERS => ['Authorization' => ['Bearer ' . $token]]]);
$data = bluesky_get($pconfig['uid'], '/xrpc/app.bsky.actor.getProfile?actor=' . urlencode($did), HttpClientAccept::JSON, [HttpClientOptions::HEADERS => ['Authorization' => ['Bearer ' . $token]]]);
I strongly suggest you switch to
http_build_query()
for these so that you don't have to remember abouturlencode()
At some point in time I want to replace these calls with some new function that does all this stuff, including the token and whatever.
@ -427,2 +426,2 @@
bluesky_fetch_notifications($pconfig['uid']);
Logger::notice('importing notifications - done', ['user' => $pconfig['uid']]);
Worker::add(['priority' => Worker::PRIORITY_MEDIUM, 'force_priority' => true], 'addon/bluesky/bluesky_timeline.php', $pconfig['uid']);
Worker::add(['priority' => Worker::PRIORITY_MEDIUM, 'force_priority' => true], 'addon/bluesky/bluesky_notifications.php', $pconfig['uid']);
The
__DIR__
doesn't work here. It has to be a relative path starting with the addon directory.@ -433,3 +431,2 @@
foreach ($feeds as $feed) {
Logger::debug('Importing feed', ['user' => $pconfig['uid'], 'feed' => $feed]);
bluesky_fetch_feed($pconfig['uid'], $feed);
Worker::add(['priority' => Worker::PRIORITY_MEDIUM, 'force_priority' => true], 'addon/bluesky/bluesky_feed.php', $pconfig['uid'], $feed);
Please use the relative path constants.
I now created two new functions for these XPRC requests.