{"size": 669, "ext": "js", "max_stars_repo_path": "server/modules/record/service/update/recordThreadsMap.js", "max_stars_repo_name": "vbarrois/arena", "max_stars_repo_stars_event_min_datetime": "2019-06-03T19:30:57.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T03:30:18.000Z", "max_issues_repo_path": "server/modules/record/service/update/recordThreadsMap.js", "max_issues_repo_name": "vbarrois/arena", "max_issues_repo_issues_event_min_datetime": "2018-07-11T18:23:34.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T09:09:51.000Z", "max_forks_repo_path": "server/modules/record/service/update/recordThreadsMap.js", "max_forks_repo_name": "vbarrois/arena", "max_forks_repo_forks_event_min_datetime": "2020-01-06T12:47:35.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-14T01:08:58.000Z"}
{"max_stars_count": 10, "max_issues_count": 650, "max_forks_count": 5, "avg_line_length": 30.4090909091, "max_line_length": 80, "alphanum_fraction": 0.77877429}
import ThreadsCache from '@server/threads/threadsCache'

const threads = new ThreadsCache()
const threadZombies = new Set() // Set of threads marked to be killed

// thread cache
export const get = recordUuid => threads.getThread(recordUuid)

export const put = (recordUuid, thread) => threads.putThread(recordUuid, thread)

export const remove = recordUuid => {
  threads.removeThread(recordUuid)
  threadZombies.delete(recordUuid)
}

// Thread zombies
export const markZombie = recordUuid => threadZombies.add(recordUuid)

export const reviveZombie = recordUuid => threadZombies.delete(recordUuid)

export const isZombie = recordUuid => threadZombies.has(recordUuid)
