Skip to content

Commit

Permalink
Remove auto-tag creation
Browse files Browse the repository at this point in the history
  • Loading branch information
krispya committed May 30, 2024
1 parent 692d248 commit 5ad27f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
6 changes: 6 additions & 0 deletions packages/scheduler/src/class/scheduler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ describe('Scheduler Class', () => {
const group1 = Symbol();
const schedule = new Scheduler();

schedule.createTag(group1);

schedule.add(aFn, { id: 'A', tag: group1 });
schedule.add(bFn, { id: 'B', after: 'A', tag: group1 });

Expand All @@ -116,6 +118,8 @@ describe('Scheduler Class', () => {
const group1 = Symbol();
const schedule = new Scheduler();

schedule.createTag(group1);

schedule.add(aFn, { id: 'A', tag: group1 });
schedule.add(bFn, { id: 'B', after: 'A', tag: group1 });
schedule.add(cFn, { id: 'C', before: group1 });
Expand All @@ -135,6 +139,8 @@ describe('Scheduler Class', () => {
const group1 = Symbol();
const schedule = new Scheduler();

schedule.createTag(group1);

schedule.add(aFn, { id: 'A', tag: group1 });
schedule.add(bFn, { id: 'B', after: 'A', tag: group1 });

Expand Down
15 changes: 0 additions & 15 deletions packages/scheduler/src/class/scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,6 @@ export class Scheduler {
}

add(runnable: Runnable<any>, options?: OptionsObject): Scheduler {
// If there are tags, check if they exist, otherwise create them.
if (options?.tag) {
if (Array.isArray(options.tag)) {
options.tag.forEach((tag) => {
if (!this.tags.has(tag)) {
createTag(this, tag);
}
});
} else {
if (!this.tags.has(options.tag)) {
createTag(this, options.tag);
}
}
}

const optionsFns = createOptionsFns(options);
add(this, runnable, ...optionsFns);

Expand Down

0 comments on commit 5ad27f9

Please sign in to comment.