summaryrefslogtreecommitdiff
path: root/fix_queue3.sh
diff options
context:
space:
mode:
authordoc <doc@filenotfound.org>2025-06-30 20:11:52 +0000
committerdoc <doc@filenotfound.org>2025-06-30 20:11:52 +0000
commit41e897f4945aaf8fbcdf0b12ac2f08c5e6ae0458 (patch)
treedb7c3520fd91abc3cf56b1a52095d23f3a80d059 /fix_queue3.sh
commit of legacy codeHEADmaster
Diffstat (limited to 'fix_queue3.sh')
-rwxr-xr-xfix_queue3.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/fix_queue3.sh b/fix_queue3.sh
new file mode 100755
index 0000000..c28d42a
--- /dev/null
+++ b/fix_queue3.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# ===== CONFIG =====
+USERNAME="$1"
+RAILS_ENV=production
+cd /home/mastodon/live || exit 1
+
+if [[ -z "$USERNAME" ]]; then
+ echo "❌ Usage: $0 <username>"
+ exit 1
+fi
+
+# Set full path for bundle
+BUNDLE_PATH="/home/mastodon/.rbenv/shims/bundle"
+
+echo "🔍 Looking up account ID for @$USERNAME..."
+ACCOUNT_ID=$(sudo -u mastodon -E env RAILS_ENV=production $BUNDLE_PATH exec rails runner "
+acct = Account.find_by(username: '$USERNAME')
+puts acct&.id || 'not_found'
+")
+
+if [[ "$ACCOUNT_ID" == "not_found" ]]; then
+ echo "❌ Account @$USERNAME not found."
+ exit 1
+fi
+
+echo "🗑️ Deleting Redis cache for home timeline..."
+sudo -u mastodon -E env RAILS_ENV=production redis-cli DEL feed:home:$ACCOUNT_ID
+
+echo "🧱 Rebuilding timeline from followed accounts..."
+sudo -u mastodon -E env RAILS_ENV=production $BUNDLE_PATH exec rails runner "
+acct = Account.find_by(username: '$USERNAME')
+if acct
+ FeedInsertWorker.push_bulk(acct.following.pluck(:id)) do |follower_id|
+ [follower_id, acct.id]
+ end
+ puts '✅ Timeline repopulation enqueued.'
+end
+"
+
+echo "✅ Done. Home timeline for @$USERNAME reset and rebuilt."