DIMMiN Notes
My working notes related to the development of dimmin.com.
2026-05-17-Sunday
- Finished up the daily watchtime calculation
- Updated the
fix_user_sessionsDjango Management Command so that args for individual users or resetting all sessions actually work - Sent the steps required to get the refresh token to test out the twitchio REST API
2026-05-16-Saturday
- Found that the backup server was deployed after the graceful shutdowns started (so it wasn't much help for fixing existing active user sessions).
- Manually updated the active users in the Production database
- Validated the updated active user daily watchtime component
- Created the start of the session based component of the daily watchtime query (clipping user sessions to the start and end of the subathon duration)
2026-05-15-Friday
- Found the bug in daily watchtime calculation - there are users who are marked as still active who actually left during the server shutdown. Since I did not get the wall of joins the last time I rebooted the server (now that I have two connections to the source I won't get the wall of joins) I'll need some other way
- Otherwise validated the daily watchtime calculation for active users (works, but we have too many active users)
- Found a way to get the list of active users in chat (up to 1k users) with the get chatters api call
2026-05-14-Thursday
- Created a backup Docker Container that runs Catalixiahbot without development, meant to run forever just to collect
Eventdata, trackable on port1336 - Updated
is_graceful_shutdownto display in the admin page - Updated the attendance validation step to mark graceful shutdowns as invalid, essentially solving the server shutdown issue with watchtime / user attendance errors
- Fixed formatting of watchtime calculation to output a human readable string in addition to the total seconds
- Started re-calculating daily watchtime from active sessions
2026-05-13-Wednesday
- Found the main bug in the watchtime calculation - session history needed to be recalculated for every user that had sessions based on invalid attendances. When the individual session was removed and sessions were re-calculated, it resulted in valid (but not necessarily directly sequential) attendances being paired together.
- Pushed updates to Production
2026-05-12-Tuesday
- Fixed the user
watchtimecalculation (invalid joins were being used when considering active sessions). Pushed these changes to Production - Found out that it takes roughly 3 minutes to allow the connection to reset to get the wall of joins back. The wall of joins takes about 60 seconds to render.
- Fixed the
fix_user_sessionscript so that it always re-calculates sessions. - Fixed watchtime AGAIN (sessions weren't processed correctly on first try on live server)
- Temporarily disabled the server reboot function until I can test the wall of joins better
2026-05-10-Sunday
- Fixed the UTC / PST timezone conversion bug by using a Django Context Processor to inject the timezone explicitly defined in the settings file throughout the project (connecting the backend and UI in timezone)
- Pushed code to Production, ran into a few bugs
- When pulling code to an active Docker Container the container restarts with the new code. Best to just stop the container to allow graceful shutdown to occur in the future.
- Applied Database Migrations to production database so that now it has the
graceful_shutdownfeature - Rotated the django secret key and switched to using Environment Variables for a few additional parameters (like timezone)
- Found out that we can check a database for corruption using the linux sqlite3's PRAGMA integrity check
- Found out that if I don't leave the server disconnected from the Socket for enough time, I don't get the collection of starting joins.
2026-05-09-Saturday
- Updated the official start time to
1778119163(catalixia's go-live message, id567c45c8-a7e0-48f0-8626-ac6578f99289) to define the start of the subathon - Watchtimes are now reflected in seconds and include both recorded sessions and incomplete sessions
- Updated the
TwitchUserAttendanceDjango Model so that we can easily identify graceful shutdowns - Updated
sessioncreation logic so that graceful shutdowns don't automatically end a user's watchtime streak (i.e if I shut down the server and restore power and the user is still there, just consider the session to have started from the last valid join before the server went down) - Wrote a series of Unit Tests to validate the new graceful shutdown handling for watchtime
2026-05-08-Friday
- Learned how to safely make a copy of a SQLlite database
- Refactored the Catalixiahbot watchtime query to account for active sessions
- Created a new Development sheet to test out ideas on instead of using the live Production sheet
- Updated the Django Management Command for the upload to gsheets function so that it uses the subathon_start Environment Variables as the default instead of
None