Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
Nightingale
提交
bce825ff
N
Nightingale
项目概览
jobily
/
Nightingale
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
Nightingale
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bce825ff
编写于
6月 29, 2020
作者:
7
710leo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change push index from async to sync
上级
3c1ed52b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
2 addition
and
21 deletion
+2
-21
src/modules/tsdb/index/update_incr.go
src/modules/tsdb/index/update_incr.go
+2
-21
未找到文件。
src/modules/tsdb/index/update_incr.go
浏览文件 @
bce825ff
...
...
@@ -7,7 +7,6 @@ import (
"github.com/didi/nightingale/src/modules/tsdb/backend/rpc"
"github.com/didi/nightingale/src/toolkits/str"
"github.com/toolkits/pkg/concurrent/semaphore"
"github.com/toolkits/pkg/logger"
)
...
...
@@ -15,17 +14,8 @@ const (
IndexUpdateIncrTaskSleepInterval
=
time
.
Duration
(
10
)
*
time
.
Second
// 增量更新间隔时间, 默认30s
)
var
(
semaUpdateIndexIncr
*
semaphore
.
Semaphore
// 索引增量更新时并发控制
)
// 启动索引的 异步、增量更新 任务, 每隔一定时间,刷新cache中的数据到数据库中
func
StartIndexUpdateIncrTask
()
{
if
rpc
.
Config
.
MaxConns
!=
0
{
semaUpdateIndexIncr
=
semaphore
.
NewSemaphore
(
rpc
.
Config
.
MaxConns
/
2
)
}
else
{
semaUpdateIndexIncr
=
semaphore
.
NewSemaphore
(
10
)
}
t1
:=
time
.
NewTicker
(
IndexUpdateIncrTaskSleepInterval
)
for
{
...
...
@@ -64,21 +54,12 @@ func updateIndexIncr() int {
tmpList
[
i
]
=
item
i
=
i
+
1
if
i
==
aggrNum
{
semaUpdateIndexIncr
.
Acquire
()
go
func
(
items
[]
*
dataobj
.
TsdbItem
)
{
defer
semaUpdateIndexIncr
.
Release
()
rpc
.
Push2Index
(
rpc
.
INCRINDEX
,
items
,
IndexList
.
Get
())
}(
tmpList
)
i
=
0
rpc
.
Push2Index
(
rpc
.
INCRINDEX
,
tmpList
,
IndexList
.
Get
())
}
}
if
i
!=
0
{
semaUpdateIndexIncr
.
Acquire
()
go
func
(
items
[]
*
dataobj
.
TsdbItem
)
{
defer
semaUpdateIndexIncr
.
Release
()
rpc
.
Push2Index
(
rpc
.
INCRINDEX
,
items
,
IndexList
.
Get
())
}(
tmpList
[
:
i
])
rpc
.
Push2Index
(
rpc
.
INCRINDEX
,
tmpList
[
:
i
],
IndexList
.
Get
())
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录