about summary refs log tree commit diff
path: root/lib/tasks
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-12-02 14:14:49 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-12-02 14:14:49 +0100
commit58b3f4fd674d29c444b236ad3936dbd04c6e175e (patch)
treec5d32fb2f38256cc116338def4d2e408e6d20624 /lib/tasks
parent2b2797d6a5902af63c3362b5abca03578f567761 (diff)
Fix #329 - avatar errors no longer prevent remote accounts from being saved
(without avatar). Also improved search position of exact matches
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/mastodon.rake11
1 files changed, 1 insertions, 10 deletions
diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake
index 8730a64cd..a95a7258f 100644
--- a/lib/tasks/mastodon.rake
+++ b/lib/tasks/mastodon.rake
@@ -11,18 +11,9 @@ namespace :mastodon do
   namespace :push do
     desc 'Unsubscribes from PuSH updates of feeds nobody follows locally'
     task clear: :environment do
-      include RoutingHelper
-
       Account.remote.without_followers.where.not(subscription_expires_at: nil).find_each do |a|
         Rails.logger.debug "PuSH unsubscribing from #{a.acct}"
-
-        begin
-          a.subscription(api_subscription_url(a.id)).unsubscribe
-        rescue HTTP::Error, OpenSSL::SSL::SSLError
-          Rails.logger.debug "PuSH unsubscribing from #{a.acct} failed due to an HTTP or SSL error"
-        ensure
-          a.update!(secret: '', subscription_expires_at: nil)
-        end
+        UnsubscribeService.new.call(a)
       end
     end