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

Use one fsevent_watch process per listener instead of one per dir #470

Closed

Conversation

tgxworld
Copy link
Contributor

@tgxworld tgxworld commented Dec 2, 2019

Related: rails/rails#26158, rails/rails#37269

This is an attempt to resolve the problem of too many fsevent_watch events being spun up on OSX since the number of processes increases with the number of directories being watched.

Screenshot 2019-12-02 at 2 20 28 PM

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Error: RuboCop found unsupported Ruby version 2.2 in `TargetRubyVersion` parameter (in .rubocop.yml). 2.2-compatible analysis was dropped after version 0.69.
Supported versions: 2.3, 2.4, 2.5, 2.6, 2.7

lib/listen/adapter/darwin.rb Outdated Show resolved Hide resolved
lib/listen/adapter/darwin.rb Outdated Show resolved Hide resolved
lib/listen/adapter/darwin.rb Outdated Show resolved Hide resolved
lib/listen/adapter/darwin.rb Show resolved Hide resolved
lib/listen/adapter/darwin.rb Show resolved Hide resolved
lib/listen/adapter/darwin.rb Show resolved Hide resolved
@tgxworld
Copy link
Contributor Author

tgxworld commented Dec 2, 2019

@ioquatix @rymai Can I get your thoughts regarding this before I look into adding the specs? Thank you!

@ioquatix
Copy link
Member

ioquatix commented Dec 2, 2019

Yeah, we should definitely fix this.

@coveralls
Copy link

coveralls commented Dec 2, 2019

Coverage Status

Coverage decreased (-0.2%) to 97.698% when pulling 6c16cb2 on tgxworld:reduce_multiple_fsevent_processes into e844336 on guard:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 97.802% when pulling 56fb995 on tgxworld:reduce_multiple_fsevent_processes into e844336 on guard:master.

@tgxworld tgxworld force-pushed the reduce_multiple_fsevent_processes branch from 56fb995 to 5764592 Compare December 5, 2019 08:44
Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Error: RuboCop found unsupported Ruby version 2.2 in `TargetRubyVersion` parameter (in .rubocop.yml). 2.2-compatible analysis was dropped after version 0.69.
Supported versions: 2.3, 2.4, 2.5, 2.6, 2.7

lib/listen/directory.rb Show resolved Hide resolved
lib/listen/adapter/darwin.rb Outdated Show resolved Hide resolved
lib/listen/adapter/darwin.rb Outdated Show resolved Hide resolved
lib/listen/adapter/darwin.rb Show resolved Hide resolved
lib/listen/adapter/base.rb Outdated Show resolved Hide resolved
@tgxworld tgxworld force-pushed the reduce_multiple_fsevent_processes branch from 5764592 to 2952cb8 Compare December 5, 2019 08:52
Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Error: RuboCop found unsupported Ruby version 2.2 in `TargetRubyVersion` parameter (in .rubocop.yml). 2.2-compatible analysis was dropped after version 0.69.
Supported versions: 2.3, 2.4, 2.5, 2.6, 2.7

@tgxworld tgxworld force-pushed the reduce_multiple_fsevent_processes branch from 2952cb8 to 7722b1b Compare December 5, 2019 08:58
Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Error: RuboCop found unsupported Ruby version 2.2 in `TargetRubyVersion` parameter (in .rubocop.yml). 2.2-compatible analysis was dropped after version 0.69.
Supported versions: 2.3, 2.4, 2.5, 2.6, 2.7

lib/listen/adapter/darwin.rb Show resolved Hide resolved
lib/listen/adapter/darwin.rb Show resolved Hide resolved
@tgxworld tgxworld force-pushed the reduce_multiple_fsevent_processes branch from 7722b1b to 6711547 Compare December 5, 2019 08:59
Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Error: RuboCop found unsupported Ruby version 2.2 in `TargetRubyVersion` parameter (in .rubocop.yml). 2.2-compatible analysis was dropped after version 0.69.
Supported versions: 2.3, 2.4, 2.5, 2.6, 2.7

@tgxworld tgxworld force-pushed the reduce_multiple_fsevent_processes branch from 6711547 to e094dba Compare December 5, 2019 09:00
Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Error: RuboCop found unsupported Ruby version 2.2 in `TargetRubyVersion` parameter (in .rubocop.yml). 2.2-compatible analysis was dropped after version 0.69.
Supported versions: 2.3, 2.4, 2.5, 2.6, 2.7

@tgxworld tgxworld force-pushed the reduce_multiple_fsevent_processes branch from e094dba to 188579a Compare December 5, 2019 09:06
Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Error: RuboCop found unsupported Ruby version 2.2 in `TargetRubyVersion` parameter (in .rubocop.yml). 2.2-compatible analysis was dropped after version 0.69.
Supported versions: 2.3, 2.4, 2.5, 2.6, 2.7

@tgxworld tgxworld force-pushed the reduce_multiple_fsevent_processes branch from 188579a to 6c16cb2 Compare December 5, 2019 09:10
Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Warning: unrecognized cop Lint/LiteralInCondition found in .rubocop.yml
Error: RuboCop found unsupported Ruby version 2.2 in `TargetRubyVersion` parameter (in .rubocop.yml). 2.2-compatible analysis was dropped after version 0.69.
Supported versions: 2.3, 2.4, 2.5, 2.6, 2.7

rel_path = new_path.relative_path_from(dir).to_s
_queue_change(:dir, dir, rel_path, recursive: true)
def _process_changes(dirs)
dirs.each do |dir|
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm aware there are two loops here but for the average use case, this is going to consist of only a couple of directories that change each time.

@tgxworld
Copy link
Contributor Author

tgxworld commented Dec 5, 2019

@ioquatix Would you mind reviewing this? Thank you so much! 🙇

@ioquatix
Copy link
Member

ioquatix commented Dec 5, 2019

I will review it tonight.

@tgxworld
Copy link
Contributor Author

tgxworld commented Dec 5, 2019

Thank you so much 👍

@ioquatix
Copy link
Member

ioquatix commented Dec 5, 2019

Using local branch: #471

@ioquatix ioquatix closed this Dec 5, 2019
@tgxworld tgxworld deleted the reduce_multiple_fsevent_processes branch December 6, 2019 00:30
johncip added a commit to napolif/commission-reporter that referenced this pull request Mar 22, 2020
I'm running into wacky amounts of CPU usage and want to rule this out as
a cause:

rails/rails#26158
guard/listen#470
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants