codegram / futuroscope

Yet another Futures implementation in Ruby
MIT License
210 stars 13 forks source link

A non-concurrent pool #22

Closed martenlienen closed 9 years ago

martenlienen commented 10 years ago

This PR implements a non-concurrent pool under the name of Futuroscope::Pools::NoPool.

It is useful for testing. I am using hyperclient with faradays rack adapter to test a HAL API. And from normal rails testing, I am used to the test server running in the same thread as the tests. This has the huge advantage, ActiveRecord in the tests and in the rack app share the same database connection, so that tests can run in a transaction and clean up is a simple rollback. This does not work anymore, when throwing threads in the mix, because ActiveRecord will reconnect and you have to actually write to the database and use database_cleaner for cleanup. The cleanup is really expensive though. A single integration test goes from 0.5 seconds to 4.5 seconds.

The last commit unifies the use of ' and " by replacing all ' with ". If you don't like it, you can of course omit it, but it kept catching my eye.

martenlienen commented 10 years ago

The build errors seems to be a bug with rubinius and Delegator. Somehow rubinius cannot instantiate a Rubinius::Mirror for Futuroscope::Future objects.

josepjaume commented 9 years ago

Hi! Sorry to chime in so late. The rubinius failing test worries me a little bit, since rubinius compatibility has been a main goal since the beginning.

Maybe something changed lately in the rubinius codebase? Do you think you can have a look at it? It looks perfectly fine otherwise :)

martenlienen commented 9 years ago

I looked at it, when I submitted the pull request. The errors comes from a line, that looks totally ok to me and seems to stem from the way rubinius implements #dup on some class. If you are proficient with rubinius, maybe you could solve it in a few minutes. Otherwise I will try again, when I have time.

txus commented 9 years ago

@CQQL Thanks for your contribution. I'll take some time next week to rethink the compatibility matrix (we're dropping support for 1.9) and fix the Rubinius issues. :)

martenlienen commented 9 years ago

Are you planning on publishing a new version? I just stumbled upon this again, because I just did a bundle outdated and saw, that we are still pulling this from my fork.

dblock commented 8 years ago

Bump, this came up in https://github.com/codegram/hyperclient/issues/102, a release would have saved @joshco some time.

joshco commented 8 years ago

Any update on this?