Skip to content

Commit 3566712

Browse files
committed
wip: disposed
1 parent e95cfec commit 3566712

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

meteor/server/publications/pieceContentStatusUI/bucket/bucketContentObserver.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ export class BucketContentObserver implements Meteor.LiveQueryHandle {
163163

164164
private updateBlueprintIds = _.debounce(
165165
Meteor.bindEnvironment(() => {
166+
if (this.#disposed) return
167+
166168
const newBlueprintIds = _.uniq(this.#cache.ShowStyleSourceLayers.find({}).map((rd) => rd.blueprintId))
167169

168170
if (!equivalentArrays(newBlueprintIds, this.#blueprintIds)) {

meteor/server/publications/pieceContentStatusUI/rundown/rundownContentObserver.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export class RundownContentObserver {
6060
this.#cache = cache
6161
}
6262

63+
#disposed = false
64+
6365
static async create(rundownIds: RundownId[], cache: ContentCache): Promise<RundownContentObserver> {
6466
logger.silly(`Creating RundownContentObserver for rundowns "${rundownIds.join(',')}"`)
6567

@@ -261,6 +263,8 @@ export class RundownContentObserver {
261263

262264
private updateShowStyleBaseIds = _.debounce(
263265
Meteor.bindEnvironment(() => {
266+
if (this.#disposed) return
267+
264268
const newShowStyleBaseIds = _.uniq(this.#cache.Rundowns.find({}).map((rd) => rd.showStyleBaseId))
265269

266270
if (!equivalentArrays(newShowStyleBaseIds, this.#showStyleBaseIds)) {
@@ -277,6 +281,8 @@ export class RundownContentObserver {
277281

278282
private updateBlueprintIds = _.debounce(
279283
Meteor.bindEnvironment(() => {
284+
if (this.#disposed) return
285+
280286
const newBlueprintIds = _.uniq(this.#cache.ShowStyleSourceLayers.find({}).map((rd) => rd.blueprintId))
281287

282288
if (!equivalentArrays(newBlueprintIds, this.#blueprintIds)) {
@@ -294,6 +300,8 @@ export class RundownContentObserver {
294300
}
295301

296302
public dispose = (): void => {
303+
this.#disposed = true
304+
297305
this.#observers.forEach((observer) => observer.stop())
298306
}
299307
}

0 commit comments

Comments
 (0)