|
|
@ -96,14 +96,19 @@ func (d *dataServant) startIndexPosts() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case <-d.expireIndexTick.C:
|
|
|
|
case <-d.expireIndexTick.C:
|
|
|
|
logrus.Debugf("expire index posts by expireIndexTick")
|
|
|
|
logrus.Debugf("expire index posts by expireIndexTick")
|
|
|
|
d.indexPosts = nil
|
|
|
|
if len(d.indexPosts) != 0 {
|
|
|
|
d.atomicIndex.Store(d.indexPosts)
|
|
|
|
d.indexPosts = nil
|
|
|
|
|
|
|
|
d.atomicIndex.Store(d.indexPosts)
|
|
|
|
|
|
|
|
}
|
|
|
|
case action := <-d.indexActionCh:
|
|
|
|
case action := <-d.indexActionCh:
|
|
|
|
switch action {
|
|
|
|
switch action {
|
|
|
|
case idxActCreatePost, idxActUpdatePost, idxActDeletePost, idxActStickPost:
|
|
|
|
case idxActCreatePost, idxActUpdatePost, idxActDeletePost, idxActStickPost:
|
|
|
|
logrus.Debugf("remove index posts by action %s", action)
|
|
|
|
logrus.Debugf("remove index posts by action %s", action)
|
|
|
|
d.indexPosts = nil
|
|
|
|
// prevent many update post in least time
|
|
|
|
d.atomicIndex.Store(d.indexPosts)
|
|
|
|
if len(d.indexPosts) != 0 {
|
|
|
|
|
|
|
|
d.indexPosts = nil
|
|
|
|
|
|
|
|
d.atomicIndex.Store(d.indexPosts)
|
|
|
|
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
// nop
|
|
|
|
// nop
|
|
|
|
}
|
|
|
|
}
|
|
|
|