You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/internal/timed_task/init.go

27 lines
394 B

package timed_task
type TimeTask struct {
delMgoChatChan chan bool
}
var timeTask TimeTask
func GetInstance() *TimeTask {
if timeTask.delMgoChatChan == nil {
timeTask.delMgoChatChan = make(chan bool)
go func() {
timeTask.delMgoChatChan <- true
}()
}
return &timeTask
}
func (t *TimeTask) Run() {
for {
select {
case <-t.delMgoChatChan:
t.timedDeleteUserChat()
}
}
}