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

Data structure problem #1

Open
srenoes opened this issue Feb 19, 2020 · 1 comment
Open

Data structure problem #1

srenoes opened this issue Feb 19, 2020 · 1 comment

Comments

@srenoes
Copy link

srenoes commented Feb 19, 2020

There is an issue with the format of the time data stored in the json file.
The problem is that sorting the messages with the stored data is not possible when more than one comment is added within one minute (In my case sorting put the entered message not in the first line, but inserted it into 2nd respective 3rd aso line. Reason is that messages have identical "timestamp" and therefore chronological sorting is impossible)

The issue could be simply ignored when sorting is not applied at all just the messages would be inserted into the lists at index [0]. This can be done because the processing is synchronous and thus blocks until the requests are finnished.

Though, generally, when doing data analysis tasks during handling of requests at the server
it might be also worth thinking about asynchronous processing.
Especially if handling requests involves heavy number crunching this would block other users to submit to the server or deny processing them until the request handling of the previous submitted task is finnished.
(Also, kind of good to be aware of when programming web servers that implement data analysis tasks)

https://realpython.com/python-async-features/

@itistheshortcut
Copy link
Owner

The write() function should not sort the posts by date. You are right that sorting should not be applied, and appending alone is enough.

I agree that async could be implemented here to handle simultaneous requests.

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

No branches or pull requests

2 participants