HearthStats / hearthstats

Details Hearthstone match statistics and tracking.
hearthstats.net
Other
88 stars 44 forks source link

Improve, refactor and add test coverage for multi_match API #506

Closed crawsible closed 9 years ago

crawsible commented 9 years ago

Hey, HearthStats!

This PR includes both performance and stability improvements to my previous PR, which should continue to improve the Delayed::Job situation. Most notably, I did some research, and found that InnoDB (if your vagrant image is to be believed, your database engine) by default will guarantee you consecutive, incremental ids for data passed in a single INSERT statement, so our assumption is less crazy than we originally thought.

In addition to that that, I also moved the Delayed::Job new match creation logic out of the DJ itself and into the Match model. This is because each instance of a delayed job serializes the struct it is passed and deserializes it upon execution. The less that needs to be serialized and deserialized each DJ run, the faster they'll be.

Hope this helps!

-csj

crawsible commented 9 years ago

Oh, yeah, absolutely! I'm not very familiar with delayed_job. Feel free to rewrite that commit if you prefer keeping master clean.

EDIT: I closed the PR by mistake. Whoops!

trigun0x2 commented 9 years ago

Awesome! I'll merge it up then try it out! :)