Last week, I achieved my main goal and got a solid start toward achieving my stretch goal.
My main goal of externalizing config in a TOML file went quite smoothly, and I think this shows the value of taking this step early. Reading the file and parsing it as a struct ended up being more concise and high level than I remembered, and since I don’t have much config yet, replacing the hardcoded values was relatively painless. I’m now set up to extend this approach very easily moving forward.
As for the stretch goal of graceful shutdown and timeouts, I set up racing the main forwarding future against a shutdown future that listens for SIGINT and SIGTERM (or on non-Unix, Ctrl+C only). This is one level more “graceful” than it was previously because the program now handles the signals and exits with status 0 instead of just being killed by the kernel. However, it doesn’t yet wait for connections to close with timeouts, which will be the next step.
This week, my main goal will be making the graceful shutdown process more graceful in the sense of actually handling any connections that are open when the process receives a shutdown signal. One key aspect of this will be timeouts to eventually forcibly disconnect if necessary instead of waiting forever.
My stretch goal will be prefix-based routing to multiple backends. While this is much simpler than the eventual load balancing I’ll do, it’s an important first step away from unconditionally routing to a single backend.
I don’t foresee any impediments.
I’d say my process last week not only went well but also reflected positive results of using a similar process in the past. Specifically, I used a combination of refining Claude-generated code by hand and manually writing code that was similar to code created through a similar process in a previous project. In other words, my approach to understanding and refining code written by Claude actually resulted in me understanding the concepts and being able to apply them on my own in a different context. While I did reference the code from the previous project rather than having every detail memorized, I think that’s fine and arguably more “correct” than spending time directly on memorization. While there wasn’t any particular negative point about my process that I plan to improve upon, I will need to make a conscious effort to maintain the same quality of learning as I encounter various new and different topics moving forward.