ruby-rdf / spira

Spira is a framework for viewing RDF data as model objects
http://rubygems.org/gems/spira
The Unlicense
58 stars 36 forks source link

Make Spira Threadsafe #15

Closed abrisse closed 11 years ago

abrisse commented 11 years ago

Spira is currently not threadsafe. Working in parallel on 2 different repositories will fail.

abrisse commented 11 years ago

@gkellogg, @cordawyn, could you look at https://github.com/PerfectMemory/spira/compare/ruby-rdf:master...feature-threadsafe?expand=1 and give me a feedback. Thanks.

cordawyn commented 11 years ago

Looks good to me. I'd change the method name to something like using_repository which is more self-explanatory, but this is not very critical. A second argument to this new method is perhaps also a bit confusing: from a developer's point of view, once I have an instance of a repository and I want to use it (within a block), its name should not matter - I'd just feed the block the repo object and that's it. At the same time though, Spira was originally designed "multirepository", which I think to be a not very good idea (if one needs to work with multiple repos, she should just create multiple instances/threads each with its own repo instance), so having a repo name as a second argument is probably ok, given Spira's design.

To summarize, :shipit:

abrisse commented 11 years ago

@cordawyn ok thanks for the feedback, I will indeed change the method name. Concerning the multirepository, I totally agree with you. I personally don't use this feature or the repository names and think it should be removed from Spira. Are you okay for the remove of that functionality ? I can provide the pull request.

cordawyn commented 11 years ago

@abrisse Yes, I totally support removing "multiple repositories" from Spira. I guess you should bump the middle version number then, as this will break (well, sort of) backward compatibility.

abrisse commented 11 years ago

I will release a new version 0.6 then.

abrisse commented 11 years ago

Multi-thread problem fixed in fa4dfd19619e2ce0a59855e45873f470a2f10914