The code for the analytics service is working now, and errors are being reported appropriately. Things seem to be going well for the media service!
But there's something not quite right about the code in the analytics background process. It's a bit too cluttered, it seems. It has too many things going on in a single file. While this isn't a large issue right now, it could become a problem in the future as new features are added. Cluttered code is hard to read and understand, and often leads to to write more code that is cluttered. It makes sense, to take a moment and clean up what's there right now, before any additional features and any new damage can be done.
In this episode, then, you'll see how the current analytics code can be cleaned up and restructured. The functionality will remain the same, but the code in each file will be reduced. When finished, each file will have one and only one purpose, allowing the code to grow and change with that one purpose over time.