1. 添加了block twitch 视频流的插件.
2. 流量减少99% 3. cpu使用率降低50% 4. 速度提高了400%
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
)
|
||||
|
||||
@@ -16,10 +15,6 @@ import (
|
||||
*/
|
||||
|
||||
func main() {
|
||||
go func() {
|
||||
http.ListenAndServe("0.0.0.0:8899", nil)
|
||||
}()
|
||||
|
||||
oe := &OpenrecExtractor{}
|
||||
oe.Execute()
|
||||
}
|
||||
|
||||
@@ -39,27 +39,9 @@ func (oe *OpenrecExtractor) Execute() {
|
||||
}()
|
||||
|
||||
var lasterr error = nil
|
||||
execute := func() bool {
|
||||
for atomic.LoadInt32(&loop) > 0 {
|
||||
var err error
|
||||
|
||||
// if sstore.PopCount() >= 1000 {
|
||||
// if err = estore.Close(); err != nil {
|
||||
// log.Println(err)
|
||||
// }
|
||||
// if err = sstore.Close(); err != nil {
|
||||
// log.Println(err)
|
||||
// }
|
||||
// estore = intimate.NewStoreExtractor()
|
||||
// sstore = intimate.NewStoreSource(string(intimate.STOpenrec))
|
||||
|
||||
// oe.supporters.Clear()
|
||||
// oe.user.Clear()
|
||||
// oe.userLive.Clear()
|
||||
|
||||
// runtime.GC() // 主动gc
|
||||
// log.Println("1000次执行, gc 重新建立sql链接")
|
||||
// }
|
||||
|
||||
source, err := sstore.Pop(intimate.TOpenrecUser, 0)
|
||||
if err != nil {
|
||||
if err != lasterr {
|
||||
@@ -67,7 +49,7 @@ func (oe *OpenrecExtractor) Execute() {
|
||||
lasterr = err
|
||||
}
|
||||
time.Sleep(time.Second * 2)
|
||||
return true
|
||||
continue
|
||||
}
|
||||
|
||||
sdata := source.Ext.([]byte)
|
||||
@@ -118,15 +100,8 @@ func (oe *OpenrecExtractor) Execute() {
|
||||
|
||||
source.Operator = int32(intimate.OperatorExtractorOK)
|
||||
sstore.UpdateOperator(source)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
for atomic.LoadInt32(&loop) > 0 {
|
||||
if !execute() {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (oe *OpenrecExtractor) extractFollowers(clog intimate.ISet) {
|
||||
|
||||
4
extractor/twitch_extractor/.gitignore
vendored
Normal file
4
extractor/twitch_extractor/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
*.html
|
||||
log
|
||||
screenlog.*
|
||||
twitch_extractor
|
||||
13
extractor/twitch_extractor/twitch_test.go
Normal file
13
extractor/twitch_extractor/twitch_test.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"intimate"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var estore = intimate.NewStoreExtractor()
|
||||
var sstore = intimate.NewStoreSource(string(intimate.STOpenrec))
|
||||
|
||||
func TestCase0(t *testing.T) {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user