Skip to content

信号触发关系 ​

图中名称函数
捕获字段旧值capture_video_update
比赛录像检测checkin_video_before_create
刷新状态队列refresh_state_queue_on_video_save
更新用户录像计数update_video_count_on_video_save / update_video_count_on_video_delete
更新用户录像上限update_video_count_limit_on_video_save
将比赛录像挂载到比赛add_created_video_to_checked_tournaments
刷新经典纪录refresh_personal_record_on_video_save / refresh_personal_record_on_video_delete
刷新pluck纪录refresh_custom_pluck_rank_on_video_save
捕获旧纪录capture_previous_records_for_news_queue
推送新闻push_news_queue_on_record_save
更新pluck榜缓存update_custom_pluck_cache_on_record_save
删除pluck榜缓存update_custom_pluck_cache_on_record_delete
更新比赛缓存update_cache_on_tournament_save
删除比赛缓存update_cache_on_tournament_delete
更新参赛缓存update_cache_on_participant_save
刷新GSC历史最好update_best_score_on_gsc_participant_save
刷新周赛历史最好update_best_score_on_weekly_participant_save
重算GSC历史最好update_best_score_on_gsc_participant_delete
重算周赛历史最好update_best_score_on_weekly_participant_delete
删除参赛缓存remove_participant_cache_on_delete
补录比赛录像add_existing_videos_to_participant_tournament

录像计数排除比赛录像。创建时读取 ongoing_tournament;删除时在 pre_delete 中检查该标记及 Tournament.videos 关联,避免级联删除清除关联后误减计数。比赛公开不增加计数。已有数据可通过 refresh_video_counts 命令重算,包括补录到比赛的历史录像;上传数量上限仍由独立的 update_video_count_limit_on_video_save 维护。

Tournament / GSCTournament / WeeklyTournament 的保存信号分别绑定到同一个 update_cache_on_tournament_save 接收器。TournamentParticipant / GSCParticipant / WeeklyParticipant 的保存信号分别绑定到同一个 update_cache_on_participant_save 接收器。缓存删除信号只保留父类接收器;多表继承删除子类时会继续触发父表删除。历史最好成绩依赖子类 participant 的成绩字段,因此由 GSCParticipant / WeeklyParticipant 的保存和删除信号单独处理:保存时只比较当前 participant 与原 best,删除时才重算该用户历史 best。best 信号更新的是 TournamentUser 数据库汇总字段,需要和 participant 变更保持事务一致,因此不使用 transaction.on_commit。