AttorneyOnlineVidya / tsuserver3

An Attorney Online server.
GNU Affero General Public License v3.0
2 stars 7 forks source link

"Database" performance, saving frequency #22

Open argoneuscze opened 6 years ago

argoneuscze commented 6 years ago

Originally posted by @argoneuscze in https://github.com/AttorneyOnlineVidya/tsuserver3/issues/21#issuecomment-431691387

Is it necessary to update the stats every second minute? I feel it should be enough to do it every half an hour or so, if even that.

And if it's needed more often, I'd suggest switching to an actual database, e.g. sqlite3 is supported by python out of the box.

argoneuscze commented 6 years ago

I'm not sure why you're now deep copying all the dictionaries.

E.g. https://github.com/AttorneyOnlineVidya/tsuserver3/blob/32657d5dce03bb0aeda5e745b8bc9dc2647ff5e6/server/database.py#L37-L40

The asynchronous code works within the same thread, there's just some overhead for the event loop, but you don't need to copy anything, as it can't be written from multiple places. There are cases where you mix asynchronous + threads, but this isn't one of them.