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

Fixes can't add a new key into hash during iteration error #174

Merged
merged 2 commits into from
Sep 27, 2017
Merged

Fixes can't add a new key into hash during iteration error #174

merged 2 commits into from
Sep 27, 2017

Conversation

ankane
Copy link
Contributor

@ankane ankane commented Sep 25, 2017

This adds thread-safety to the MemoryStore. Here's code to reproduce the current issue.

Thread.abort_on_exception = true

$store = Makara::Cache::MemoryStore.new

workers = 10.times.map do
  Thread.new do
    loop do
      $store.write(rand(100), true, expires_in: 1)
      sleep(rand / 100)
    end
  end
end

workers.map(&:join)

@bleonard
Copy link
Contributor

Thanks @ankane - Think you could add the test case to the cache_spec?

@ankane
Copy link
Contributor Author

ankane commented Sep 25, 2017

Hey @bleonard, thanks for the response. Added a test case.

@bleonard bleonard merged commit 9a441f3 into instacart:master Sep 27, 2017
@bleonard
Copy link
Contributor

@ankane - I've added you as a member if you'd like to participate with makara. Seems like a good idea if you are depending on it.

If so, want to test out master and tag a new release, etc?

@ankane
Copy link
Contributor Author

ankane commented Sep 27, 2017

Yeah, happy to help out. I'll defer to you on when to release new versions. We'll try to get on master in the near future.

@ankane
Copy link
Contributor Author

ankane commented Sep 28, 2017

Hey @bleonard, looks like I was invited to join org rather than this specific project.

@bleonard
Copy link
Contributor

It was a team that was only on makara projects. Now given project access if that's better for you.

@ankane
Copy link
Contributor Author

ankane commented Sep 28, 2017

Ah, gotcha. All good now. Thanks.

@bleonard
Copy link
Contributor

Interesting that Ruby 2 is freaking out (no log) on Travis. https://travis-ci.org/taskrabbit/makara/builds/280541383

Some sort of Mutex or thread difference?

@ankane
Copy link
Contributor Author

ankane commented Sep 28, 2017

That's odd. Can you try restarting the jobs?

@bleonard
Copy link
Contributor

Actually the nextval one (#173) failed first all in Ruby 2. Then this one, so likely not this one. Likely not that one either based on it's simplicity.

@bleonard
Copy link
Contributor

https://travis-ci.org/taskrabbit/makara/jobs/280541385 bundler failing to install in that ruby. tried similar setup locally and it worked.

@ankane
Copy link
Contributor Author

ankane commented Sep 30, 2017

@bleonard fixed in #176

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.

2 participants