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

Fix not executing multiple fork tasks #64

Merged
merged 1 commit into from
May 31, 2017

Conversation

eisuke
Copy link
Member

@eisuke eisuke commented May 30, 2017

Fix the bug #62

@cookpad/dev-infra please review.

def children
token.context['fork_children_ids'] ||= {}
child_ids = token.context['fork_children_ids'][token.path] ||= []
if child_ids.present?
Copy link
Member

Choose a reason for hiding this comment

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

using empty? is enough?

@@ -44,6 +53,7 @@ def create_child_token(child_node:, env: {})
attributes['context']['ENV'] = (attributes['context']['ENV'] || {}).merge(env)

Token.create!(attributes).tap do |created|
token.context['fork_children_ids'][token.path] << created.id
Copy link
Member

Choose a reason for hiding this comment

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

this can be nil?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, It is always Array.
But I came to feel it is hard to notice. fixed aad3d24

@@ -32,6 +31,19 @@ def validate

private

def children
if fork_children_ids.present?
Copy link
Member

Choose a reason for hiding this comment

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

this should be always Array; empty? is enough. present? doesn't perform a empty-ness check only.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed it in 7d5f388 (Also fix redundant repeating empty?).

@eisuke eisuke force-pushed the fix_multiple_forks branch from 7d5f388 to 73740a5 Compare May 31, 2017 04:51
@eisuke eisuke merged commit 48e168c into cookpad:master May 31, 2017
@eisuke eisuke deleted the fix_multiple_forks branch May 31, 2017 05:36
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.

3 participants