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

Move network calls out of transaction in ActivityPub handler #8951

Merged
merged 1 commit into from
Oct 10, 2018

Conversation

Gargron
Copy link
Member

@Gargron Gargron commented Oct 10, 2018

Mention and emoji code may perform network calls, but does not need
to do that inside the database transaction. This may improve availability
of database connections when using pgBouncer in transaction mode.

@Gargron Gargron added the performance Runtime performance label Oct 10, 2018
end

def process_tags(status)
@params = begin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why begin here? shouldn't this just be @params = { ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise rubocop will require me to align the hash with the = which sucks. begin/end does nothing except improve the formatting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which rule was it? Layout/AlignHash definitely doesn't work that way. We should make sure to change the rubocop lint formatting when we run into a situation where it's behaving badly, so that we're consistent across PRs

Copy link
Member Author

@Gargron Gargron Oct 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I am aware we are required to:

  hash = {
           foo: bar,
           baz: boo,
         }

Which looks bad.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that the default Layout/AlignHash and Layout/IndentHash rule should pass with this code:

hash = {
  foo: bar,
  baz: boo,
}

@nightpool
Copy link
Member

nightpool commented Oct 10, 2018

approve modulo formatting nits

Mention and emoji code may perform network calls, but does not need
to do that inside the database transaction. This may improve availability
of database connections when using pgBouncer in transaction mode.
@Gargron Gargron merged commit 790d3bc into master Oct 10, 2018
@Gargron Gargron deleted the fix-network-in-transaction branch October 10, 2018 22:50
Gargron added a commit that referenced this pull request Oct 11, 2018
Gargron added a commit that referenced this pull request Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Runtime performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants