acfun_comments_observer_backend

command module
v0.1.2-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 6 Imported by: 0

README

AcFun Comments Observer Backend

A站评论观察者后端

依赖

使用组件

  • gorm
  • protoactor-go
  • zap
  • vipper

结构

Main
├── HttpServer(ToDo)
├── obctrl (ObserverController)
    ├── articleslistob (ArticlesListObserver)
        ├── commentsob (CommentsObserver)

业务流程

启动流程
sequenceDiagram
note over Main: 初始全局化配置
Main ->> obctrl: spawn(创建新actor)
obctrl ->> articleslistob: spawn(创建新actor,可以创建多个)
note over obctrl: 初始化全局db
obctrl ->> articleslistob: ResourceReadyMsg
articleslistob ->> commentsob: spwan(创建新actor,可以创建多个)
articleslistob ->> commentsob: ResourceReadyMsg
note over commentsob: 初始化db资源
commentsob ->> articleslistob: CommentsObReadyMsg
note over articleslistob: 等待收到所有commentsob的CommentsObReadyMsg
articleslistob ->> obctrl: ArticlesListObReadyMsg
note over obctrl,commentsob: 根据配置开始观测
运行流程
sequenceDiagram
obctrl ->> articleslistob_x: ObserveArticlesListTaskMsg(需要观测的文章区列表)
articleslistob_x -->> proxy pool: 获取https代理
proxy pool -->> articleslistob_x: 返回https代理
articleslistob_x ->> Internet: 获取文章区列表的aid(Article ID)
Internet ->> articleslistob_x: 获取文章区列表的aid(Article ID)
articleslistob_x ->> commentsob_x: ObserveCommentsTaskMsg(Article ID List)
commentsob_x -->> proxy pool: 获取https代理
proxy pool -->> commentsob_x: 返回https代理
loop Article ID List不为空
	commentsob_x ->> Internet: 获取comments
	Internet ->> commentsob_x: comments
	note over commentsob_x: 保存db
end
commentsob_x ->> articleslistob_x: ObserveCommentsTaskFinishedMsg消息
note over articleslistob_x: 等待收到所有commentsob的ObserveCommentsTaskFinishedMsg消息
note over articleslistob_x, Internet: 开始下一轮观测

异常流程
sequenceDiagram
obctrl ->> articleslistob_x: ObserveArticlesListTaskMsg(需要观测的文章区列表)
articleslistob_x -->> proxy pool: 获取https代理
proxy pool -->> articleslistob_x: 返回https代理
articleslistob_x ->> Internet: 获取文章区列表的aid(Article ID)
Internet -x articleslistob_x: 获取文章区列表的aid(Article ID)
articleslistob_x -->> proxy pool: 获取https代理(尝试更换代理)
proxy pool -->> articleslistob_x: 返回https代理
articleslistob_x ->> Internet: 获取文章区列表的aid(Article ID)
Internet ->> articleslistob_x: 获取文章区列表的aid(Article ID)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
getter
Generated by https://quicktype.io
Generated by https://quicktype.io
getter
Generated by https://quicktype.io
Generated by https://quicktype.io
dao
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL