summaryrefslogtreecommitdiff
path: root/scripts/pre-commit (unfollow)
Commit message (Collapse)AuthorFilesLines
11 days*/Makefile: Update againRunxi Yu6-14/+45
11 days*: Further restructuringRunxi Yu11-7/+66
11 days*.go: Move to backendRunxi Yu18-2/+4
And adjust Makefiles, admin handbook, and lint.sh accordingly.
11 daysiadocs: Update IA documentationRunxi Yu10-44/+279
12 daysdocs: max-width: 50rem;Runxi Yu1-1/+1
12 daysdocs/admin: Document database setupRunxi Yu1-1/+10
12 daysdocs/admin: Update protocol informationRunxi Yu1-3/+2
12 daysiadocs: Cover page updateRunxi Yu1-5/+5
12 days{,u}sem.go, ws*.go: Restructure filesRunxi Yu5-235/+319
12 days{config,main}.go: Enhance configuration file processingRunxi Yu2-8/+124
Implements: https://todo.sr.ht/~runxiyu/cca/5
12 daysbench.go: ReformatRunxi Yu1-2/+2
12 daysbench.go: Separate connection stage from selection stagev0.1.3Runxi Yu1-2/+10
12 daysbench.go: More realistic benchmark for one course onlyRunxi Yu1-9/+18
12 daysMakefile: BSD Make also supports wildcards in targetsRunxi Yu1-1/+1
12 daysMakefile: Add sem.go to source file listRunxi Yu1-1/+1
12 days{config,ws}.go, cca.scfg.example: Add perf.course_update_intervalRunxi Yu3-6/+14
This causes a drastic increase in performance. References: https://todo.sr.ht/~runxiyu/cca/7
12 days{courses,wsm}.go: Use in-memory structure to fetch cgroup, not SQLRunxi Yu2-26/+18
12 days{config,ws}.go, cca.scfg.example: Remove chanPool/SendQRunxi Yu3-59/+0
12 daysws.go: &usemT{} //exhaustruct:ignoreRunxi Yu1-1/+1
12 daysws.go: Check error of populateUserCourseGroupsRunxi Yu1-1/+4
12 dayswsm.go: Omit comparison to bool constantRunxi Yu1-1/+1
11 dayswsm.go: Report error when course doesn't existRunxi Yu1-0/+8
Luckily we encounter a database error before we have the chance to dereference a null pointer. But it's still good practice to check.
11 days{courses,sem,ws,wsm}.go: Second step towards an efficient state propagatorRunxi Yu4-16/+24
References: https://todo.sr.ht/~runxiyu/cca/7
11 days{courses,sem,ws}.go: First step towards an efficient state propagatorRunxi Yu3-6/+110
References: https://todo.sr.ht/~runxiyu/cca/7
11 daysgo.sum: go mod tidy (removing old checksums)Runxi Yu1-6/+0
11 daysws.go: Index chanPool by userID, rather than session cookieRunxi Yu1-5/+2
11 days{main,utils,ws}.go: Initialize cancelPool directly tooRunxi Yu3-25/+1
11 daysBump dependenciesRunxi Yu2-3/+9
11 days{main,ws}.go: Initialize chanPool directly instead of setupChanPool()Runxi Yu2-22/+1
It is possible to use var chanPool = make(map[string](*chan string)) directly during declaration, even if it's a global variable. There is no need to call a function to initialize it.
11 dayscourses.go: ReformatRunxi Yu1-1/+1
11 days{courses,wsm}.go: Add getCourseByIDRunxi Yu2-10/+8
This also deduplicates some code.
11 days{courses,wsm}.go: Add (*courseT).decrementSelectedAndPropagateRunxi Yu2-24/+15
This is being done quite a few times, so let's make it a function.
11 days{courses,ws,wsm}.go: Update userCourseGroups during choose/unchooseRunxi Yu3-12/+51
11 daysconfig.go: Emit warning when fake auth is enabledRunxi Yu1-0/+2
11 daysbench.go: Don't close request bodyRunxi Yu1-6/+0
The WebSocket library closes it for us (which is not behavior that I like, but fine). Closing it again causes segmentation faults as Body becomes a null pointer or something like that.
11 days{courses,ws}.go: Populate userCourseGroups in a separate functionRunxi Yu2-32/+35
12 days{courses,ws}.go: Populate userCourseGroups for each connectionRunxi Yu2-5/+63
It is way too expensive to query the database every time we need to check whether a user has chosen a course in a group. Since we can (hopefully) guarantee that there is only one usable connection for any given moment and user, we could store this data along with the connection as a local variable in handleConn, which would be eligible for garbage collection when handleConn exits. Here we create the data structures that globally represent courseTypes and courseGroups, and during the initial stages of handleConn, perform database queries to populate userCourseGroups with the groups that the user has already chosen. Note that the HELLO command handler does similar database queries, and as per the TODO listed in the comments, should be moved up here for efficiency. (HELLO also serves as some sort of an initial connection check; this should probably be replaced with WebSocket's native pings.)
12 dayscourses.go, schema.sql: Validate course{Type,Group} in server, not SQLRunxi Yu4-30/+45
12 days*.sql: New schema with ctypes and cgroupsRunxi Yu3-18/+39