• Monday

    • Private work.
    • Back to nyc.
    • JS notes in gdoc.
    • Link another credit card save/connect tool.
    • Naiad, canid, canna, dacha.
    • Linkedin premium is ~$30/mo (individual).
    • Leetcode premium is ~$11/mo (annual sub, cyber monday deal). Dynamic layout, autocompletion, debugger, access to premium problems, access to some editorials, faster execution.
    • React.memo.
    • Supercontest.
      • AWS Billing and Cost Management.
        • Enabled cost optimization suggestions. Creates a role to access your other services, collects usage, gives realtime updates.
        • Opted into and played with Compute Optimizer.
        • Created a cost monitor and attached subscription (my email). Sends daily summaries and alerts if >50% above expected (a single day, I believe).
        • Created 4 budgets: 1 for monthly spend under a certain amount (actual AND projected), and 3 for each RI ensuring that utilization of the RI is 100%. All 4 email me if triggered.
      • VSCode SSH Remote.
        • Installed all extensions in the sbsc remote. Remember this is an installation on the remote.
        • It bricked the EC2 instance. Not sure which extension. Maybe one of the windows-specific ones?
        • Rebooted from EC2, connected, removed all vscode extensions (kept them local, uninstalled from ssh:sbsc).
        • Remember the disconnections could have been from my poor internet too. Just wait a few.
      • Remember you can make build-start-prod without losing any data, even if you restart or stop-prod manually, and that’s how it’s always been. BUT it USED to be the case that make down-prod would wipe the DB volume. Now that’s clean too – it persists in RDB, regardless if prod docker composition (just app+nginx) is downed.
      • ElastiCache.
        • Went through the app and added some view function cached and regular function memoize decorators.
        • Played with an initial memoization from flask-cli. Nothing was persisting. Ah – it’s because CLI uses NullCache. Changes so the prod flask cli connects to the prod elasticache (like it already does with rds).
        • Note: you cannot traverse sqla relationships from a cached object. The parent obj is not bound to a session, the dependents are dangling.
        • You can change this to subquery or selectin loading (rather than the default lazy, which queries at ACCESS time)(https://docs.sqlalchemy.org/en/20/orm/queryguide/relationships.html) or manually load all children on the dangling object with new queries, but then we defeat the whole purpose of a cache.
        • Memoized most of the functions in queries (as long as they return something, and something other than direct sqla objects). This should speed up some stuff like get_current_week(), is_regseason(), etc. TTL set to 30, since the intention for the memoization is intra-request optimization, not inter. Will do that with view caching next.
        • Also – you don’t really want to cache anything outside of query libs. I have lots of functionality in utils and other libs. But the point of the cache is to optimally save a db trip. If the other logic is a local compute op, up to a reasonable ceiling of time complexity, it’s faster than network-hitting redis anyway.
        • Added caching for the main view functions. Set TTL to 60 to match the frequency of the score fetch, the primary cache invalidator.
        • Skipped caching for API endpoints, stuff like /email-all-picks and /commit-scores.
        • Created followup ticket for event-driven cache invalidation (based on supercontest.dbsession.commits), rather than blanket time-driven TTLs right now.
        • Deployed to prod, tested, ready for MNF.
      • Created a new cost report for Amortized blending (takes the RIs and extends their costs in the daily/usage expenses). And then filtered RIs out of the main cost report for daily service totals.
      • Added paid users, now to 20. Expect 27 total.
        • There was an infinite recursion in the function that adjusts purses for ties. This occurred when there were only 4 people in the paid league. Not sure which ranks were tied.
        • Will debug this next time I see it.
      • Enabled some aws cost mgmt prefs: multi-year lookback at monthly granularity (up to 38mo), daily granularity for all services up to 14 day lookback (from 7, default).