Skip to content

Fix digest mix task on OTP releases

Michael Weiss requested to merge primeos/pleroma:fix/digest-task-otp into develop

This is based on #2191 (closed), credit belongs to @rinpatch.


Warning: I only have an OTP setup and didn't test this! It's only a suggestion based on !2191 (merged) (after I've found #1548 (closed)). Feel free to modify or even replace this MR and reuse the changes without giving me any credit (testing is the real work here and I basically just copied !2191 (merged)). Hope this helps anyway :)

With OTP release 2.0.4 I get the following output:

pleroma@social:~$ ./bin/pleroma_ctl digest test michael

12:27:32.995 [debug] QUERY OK source="users" db=3.5ms idle=86.0ms
SELECT u0."id", u0."bio", u0."email", u0."name", u0."nickname", u0."password_hash", u0."keys", u0."ap_id", u0."avatar", u0."local", u0."follower_address", u0."following_address", u0."tags", u0."last_refreshed_at", u0."last_digest_emailed_at", u0."banner", u0."background", u0."source_data", u0."note_count", u0."follower_count", u0."following_count", u0."locked", u0."confirmation_pending", u0."password_reset_pending", u0."confirmation_token", u0."default_scope", u0."domain_blocks", u0."deactivated", u0."no_rich_text", u0."ap_enabled", u0."is_moderator", u0."is_admin", u0."show_role", u0."settings", u0."magic_key", u0."uri", u0."hide_followers_count", u0."hide_follows_count", u0."hide_followers", u0."hide_follows", u0."hide_favorites", u0."unread_conversation_count", u0."pinned_activities", u0."email_notifications", u0."mascot", u0."emoji", u0."pleroma_settings_store", u0."fields", u0."raw_fields", u0."discoverable", u0."invisible", u0."allow_following_move", u0."skip_thread_containment", u0."actor_type", u0."also_known_as", u0."notification_settings", u0."blocks", u0."mutes", u0."muted_reblogs", u0."muted_notifications", u0."subscribers", u0."inserted_at", u0."updated_at" FROM "users" AS u0 WHERE (u0."nickname" = $1) ["michael"]

12:27:33.000 [debug] QUERY OK source="user_relationships" db=3.4ms idle=90.5ms
SELECT u0."relationship_type", array_agg(u1."ap_id") FROM "user_relationships" AS u0 INNER JOIN "users" AS u1 ON u1."id" = u0."target_id" WHERE (u0."source_id" = $1) AND (u0."relationship_type" = ANY($2)) GROUP BY u0."relationship_type" [<<0, 0, 1, 113, 234, 175, 55, 57, 36, 99, 151, 215, 160, 82, 0, 0>>, [1, 4]]

12:27:33.006 [debug] QUERY OK source="notifications" db=5.4ms queue=0.1ms idle=94.6ms
SELECT n0."id", n0."seen", n0."user_id", n0."activity_id", n0."inserted_at", n0."updated_at", a1."id", a1."data", a1."local", a1."actor", a1."recipients", a1."inserted_at", a1."updated_at", o2."id", o2."data", o2."inserted_at", o2."updated_at" FROM "notifications" AS n0 INNER JOIN "activities" AS a1 ON a1."id" = n0."activity_id" LEFT OUTER JOIN "objects" AS o2 ON (o2."data"->>'id') = COALESCE((a1."data" -> 'object'::text) ->> 'id'::text) LEFT OUTER JOIN "thread_mutes" AS t3 ON (t3."user_id" = $1) AND (t3."context" = a1."data"->>'context') WHERE (n0."user_id" = $2) AND (a1."actor" not in (SELECT ap_id FROM users WHERE deactivated = 'true')) AND (NOT (a1."actor" = ANY($3))) AND (t3."user_id" IS NULL) AND (NOT (a1."actor" = ANY($4))) AND (NOT (substring(a1."actor" from '.*://([^/]*)') = ANY($5))) AND (a1."data"->>'type' != 'Move') AND (n0."updated_at" > $6) [<<0, 0, 1, 113, 234, 175, 55, 57, 36, 99, 151, 215, 160, 82, 0, 0>>, <<0, 0, 1, 113, 234, 175, 55, 57, 36, 99, 151, 215, 160, 82, 0, 0>>, [], [], [], ~N[2020-05-06 15:51:23]]
** (UndefinedFunctionError) function Mix.shell/0 is undefined (module Mix is not available)
    Mix.shell()
    lib/mix/tasks/pleroma/digest.ex:28: Mix.Tasks.Pleroma.Digest.run/1
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6

Merge request reports