MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / CleanupChannelPollingLocks

Function CleanupChannelPollingLocks

model/channel.go:507–523  ·  view source on GitHub ↗

CleanupChannelPollingLocks removes locks for channels that no longer exist This is optional and can be called periodically to prevent memory leaks

()

Source from the content-addressed store, hash-verified

505// CleanupChannelPollingLocks removes locks for channels that no longer exist
506// This is optional and can be called periodically to prevent memory leaks
507func CleanupChannelPollingLocks() {
508 var activeChannelIds []int
509 DB.Model(&Channel{}).Pluck("id", &activeChannelIds)
510
511 activeChannelSet := make(map[int]bool)
512 for _, id := range activeChannelIds {
513 activeChannelSet[id] = true
514 }
515
516 channelPollingLocks.Range(func(key, value interface{}) bool {
517 channelId := key.(int)
518 if !activeChannelSet[channelId] {
519 channelPollingLocks.Delete(channelId)
520 }
521 return true
522 })
523}
524
525func handlerMultiKeyUpdate(channel *Channel, usingKey string, status int) {
526 keys := channel.getKeys()

Callers

nothing calls this directly

Calls 1

DeleteMethod · 0.45

Tested by

no test coverage detected