Writing this as a relief and to vent a bit… I guess.
So first of all Happy New Year! Hopefully this year will be filled with pure awesomeness. Secondly, my god managed network requests can really burn you.
I stumbled upon two serious bugs, one being that Atom reader wasn’t doing its job properly and I ended up writing it completely thus now it shouldn’t have any problems. Now, parsing through content can be sometimes tedious but manageable. I have done it so many times in the past in unrelated projects that I more or less know how to handle certain issues.
Networking sadly… is a new issue for me, but see my conclusion wasn’t that the tool was bad… rather that my application’s design is not bad but doesn’t really adjust to how
QNetworkAccessManager plays. The designed classes to read Atom and make requests were both really bad designs as in, at least in the network part, was naively crafted. I had this great idea of stress testing my application to see how it would handle large amount of requests, in turn I had to implement around 300 line of codes to fix a few annoying issues and thus took care of:
- Web servers don’t play nicely, don’t expect it to accept your request if your request don’t have headers like
User-Agent. I then by mistake added
gzipin my Accept-Encoding which forced me to remove it as I currently have no interest in reading compressed content (yet).
- No timeout. No timeout is just that. If your request doesn’t make it don’t expect the
replyto erase itself. I didn’t have any timeout management
- No supervision on how many requests to make per… … per what? there wasn’t any restriction thus it made the QNetworkAccessManager behave completely different.
The solution I have created felt so hack-ish I’m not slightly happy about it thus I’ll have to redesign how the network part interacts and how the network part interacts with the database.
While I was testing I ran into another problem: there’s no way to prioritize signals in Qt so I have to do the abstraction myself, which I don’t mind. To me providing a responsive interface is more important than the availability of data (which should fall into a “normal” priority). So in that department … I literally have to refactor a large portion of the application which is scary itself.
But… I must cut my losses and carry on. Most of the problems have been bad design itself… which is good and bad. Good because most of the logic is sound, bad because the design is a clusterfuck to manage.
Aight, well… go me, I guess.