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

concurrency saving problems (malformed JSON) #40

Closed
wants to merge 2 commits into from
Closed

concurrency saving problems (malformed JSON) #40

wants to merge 2 commits into from

Conversation

smysnk
Copy link

@smysnk smysnk commented Jan 25, 2013

Hopefully I am doing this correctly, created a new branch without my other modifications. This branch should solve the concurrency saving problems. I realize most people won't run into this issue but just incase!

…the same time would produce malformed JSON
@smysnk
Copy link
Author

smysnk commented Jan 25, 2013

Still working on my concurrency skills, what you're suggesting sounds cleaner.

@tntim96
Copy link
Owner

tntim96 commented Jan 27, 2013

Thanks.

Due to the multiple commits I've added this in manually, so let me know if I missed anything.

While not the ideal approach (saving data concurrently to separate files would be better) it is definitely an improvement, but may lead to web-request time-outs. I've committed to trunk but haven't created a separate release. Let me know if that is preferable.

@tntim96 tntim96 closed this Jan 27, 2013
@smysnk
Copy link
Author

smysnk commented Jan 27, 2013

I am currently using a fork so no need to worry about a new release. Thanks

The saving/merging process would rarely take longer than a second, I don't think timeouts will be a problem.

@tntim96
Copy link
Owner

tntim96 commented Jan 27, 2013

Actually, you might as well stick with the save/merge process for the time being. The above code won't work as the objects are created for each thread and need something else to use as a lock. In addition, even if it did work (by locking on JSONDataSaver.class for example) it will cause blocking even if the threads are saving to different report directories. I'll try to add a solution that only blocks when the report directory is the same.

@ghost ghost assigned tntim96 Jan 27, 2013
@tntim96
Copy link
Owner

tntim96 commented Jan 28, 2013

I think I've fixed this in trunk - i.e. it only blocks the thread if the report directory is already in use. My testing looks OK, but if you get a chance, let me know how it goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants