MCPcopy Create free account
hub / github.com/ether/etherpad / listSessionsWithDBKey

Function listSessionsWithDBKey

src/node/db/SessionManager.ts:246–266  ·  view source on GitHub ↗
(dbkey: string)

Source from the content-addressed store, hash-verified

244 * @return {Promise<*>}
245 */
246const listSessionsWithDBKey = async (dbkey: string) => {
247 // get the group2sessions entry
248 const sessionObject = await db.get(dbkey);
249 const sessions = sessionObject ? sessionObject.sessionIDs : null;
250
251 // iterate through the sessions and get the sessioninfos
252 for (const sessionID of Object.keys(sessions || {})) {
253 try {
254 sessions[sessionID] = await exports.getSessionInfo(sessionID);
255 } catch (err:any) {
256 if (err.name === 'apierror') {
257 console.warn(`Found bad session ${sessionID} in ${dbkey}`);
258 sessions[sessionID] = null;
259 } else {
260 throw err;
261 }
262 }
263 }
264
265 return sessions;
266};
267
268
269/**

Callers 1

SessionManager.tsFile · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected