The code powering m.abunchtell.com https://m.abunchtell.com
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 

50 Zeilen
1.5 KiB

  1. namespace :mastodon do
  2. namespace :media do
  3. desc 'Removes media attachments that have not been assigned to any status for longer than a day'
  4. task clear: :environment do
  5. MediaAttachment.where(status_id: nil).where('created_at < ?', 1.day.ago).find_each(&:destroy)
  6. end
  7. end
  8. namespace :push do
  9. desc 'Unsubscribes from PuSH updates of feeds nobody follows locally'
  10. task clear: :environment do
  11. include RoutingHelper
  12. Account.remote.without_followers.where.not(subscription_expires_at: nil).find_each do |a|
  13. Rails.logger.debug "PuSH unsubscribing from #{a.acct}"
  14. begin
  15. a.subscription(api_subscription_url(a.id)).unsubscribe
  16. rescue HTTP::Error, OpenSSL::SSL::SSLError
  17. Rails.logger.debug "PuSH unsubscribing from #{a.acct} failed due to an HTTP or SSL error"
  18. ensure
  19. a.update!(secret: '', subscription_expires_at: nil)
  20. end
  21. end
  22. end
  23. desc 'Re-subscribes to soon expiring PuSH subscriptions'
  24. task refresh: :environment do
  25. Account.expiring(1.day.from_now).find_each do |a|
  26. Rails.logger.debug "PuSH re-subscribing to #{a.acct}"
  27. SubscribeService.new.(a)
  28. end
  29. end
  30. end
  31. namespace :feeds do
  32. desc 'Clears all timelines so that they would be regenerated on next hit'
  33. task clear: :environment do
  34. $redis.keys('feed:*').each { |key| $redis.del(key) }
  35. end
  36. end
  37. namespace :graphs do
  38. desc 'Syncs all follow relationships to Neo4J'
  39. task sync: :environment do
  40. Follow.find_each(&:sync!)
  41. end
  42. end
  43. end