Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip some methods in BatchedRemoveStatusService when account is nil #10095

Conversation

Projects
None yet
2 participants
@nosada
Copy link
Contributor

nosada commented Feb 21, 2019

Sometimes bin/tootctl accounts cull fails with below error:

undefined method `followers_for_local_distribution' for nil:NilClass (NoMethodError)

This PR makes BatchedRemoveStatusService.new.call() to skip below methods when
account in it is nil:

  • unpush_from_home_timelines()
  • unpush_from_list_timelines()
  • batch_stream_entries()
Skip some methods in BatchedRemoveStatusService when account is nil
Sometimes `bin/tootctl accounts cull` fails with below error:

undefined method `followers_for_local_distribution' for nil:NilClass (NoMethodError)

This commit makes BatchedRemoveStatusService to skip below methods when
`account` is nil:

- unpush_from_home_timelines()
- unpush_from_list_timelines()
- batch_stream_entries()
@nosada

This comment has been minimized.

Copy link
Contributor Author

nosada commented Feb 21, 2019

FYI: Below is full traceback message for this issue (/opt/mastodon/ is where mastodon code is located in my environment).

[mastodon@mstdnspawn ~]$ RAILS_ENV=production bin/tootctl accounts cull
warning: parser/current is loading parser/ruby26, which recognizes
warning: 2.6.0-compliant syntax, but you are running 2.6.1.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
....+.+...........+.+.....++..............+.....+...............+..............Traceback (most recent call last):
        32: from bin/tootctl:5:in `<main>'
        31: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
        30: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
        29: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
        28: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
        27: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor.rb:238:in `block in subcommand'
        26: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:115:in `invoke'
        25: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
        24: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
        23: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
        22: from /opt/mastodon/lib/mastodon/accounts_cli.rb:225:in `cull'
        21: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2/lib/active_record/relation/batches.rb:69:in `find_each'
        20: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2/lib/active_record/relation/batches.rb:135:in `find_in_batches'
        19: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2/lib/active_record/relation/batches.rb:222:in `in_batches'
        18: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2/lib/active_record/relation/batches.rb:222:in `loop'
        17: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2/lib/active_record/relation/batches.rb:238:in `block in in_batches'
        16: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2/lib/active_record/relation/batches.rb:136:in `block in find_in_batches'
        15: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2/lib/active_record/relation/batches.rb:70:in `block in find_each'
        14: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2/lib/active_record/relation/batches.rb:70:in `each'
        13: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2/lib/active_record/relation/batches.rb:70:in `block (2 levels) in find_each'
        12: from /opt/mastodon/lib/mastodon/accounts_cli.rb:240:in `block in cull'
        11: from /opt/mastodon/app/services/suspend_account_service.rb:46:in `call'
        10: from /opt/mastodon/app/services/suspend_account_service.rb:64:in `purge_content!'
         9: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2/lib/active_record/relation/batches.rb:135:in `find_in_batches'
         8: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2/lib/active_record/relation/batches.rb:222:in `in_batches'
         7: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2/lib/active_record/relation/batches.rb:222:in `loop'
         6: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2/lib/active_record/relation/batches.rb:238:in `block in in_batches'
         5: from /opt/mastodon/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2/lib/active_record/relation/batches.rb:136:in `block in find_in_batches'
         4: from /opt/mastodon/app/services/suspend_account_service.rb:65:in `block in purge_content!'
         3: from /opt/mastodon/app/services/batched_remove_status_service.rb:35:in `call'
         2: from /opt/mastodon/app/services/batched_remove_status_service.rb:35:in `each_value'
         1: from /opt/mastodon/app/services/batched_remove_status_service.rb:38:in `block in call'
/opt/mastodon/app/services/batched_remove_status_service.rb:65:in `unpush_from_home_timelines': undefined method `local?' for nil:NilClass (NoMethodError)

@nosada nosada force-pushed the nosada:fix/skip-batched-remove-status-service-when-account-is-nil branch from 1919411 to 8c13d7b Feb 24, 2019

@Gargron Gargron merged commit e050958 into tootsuite:master Feb 24, 2019

11 checks passed

ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: check-i18n Your tests passed on CircleCI!
Details
ci/circleci: install Your tests passed on CircleCI!
Details
ci/circleci: install-ruby2.4 Your tests passed on CircleCI!
Details
ci/circleci: install-ruby2.5 Your tests passed on CircleCI!
Details
ci/circleci: install-ruby2.6 Your tests passed on CircleCI!
Details
ci/circleci: test-ruby2.4 Your tests passed on CircleCI!
Details
ci/circleci: test-ruby2.5 Your tests passed on CircleCI!
Details
ci/circleci: test-ruby2.6 Your tests passed on CircleCI!
Details
ci/circleci: test-webui Your tests passed on CircleCI!
Details
codeclimate All good!
Details

@nosada nosada deleted the nosada:fix/skip-batched-remove-status-service-when-account-is-nil branch Mar 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.