Skip to content

Commit

Permalink
feat: fix WatcherEx not triggered issue
Browse files Browse the repository at this point in the history
  • Loading branch information
hsluoyz committed Nov 21, 2023
1 parent 8be6187 commit 61c1595
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/internalEnforcer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,12 @@ export class InternalEnforcer extends CoreEnforcer {
}

if (useWatcher) {
if (this.watcher && this.autoNotifyWatcher) {
if (this.autoNotifyWatcher) {
// In fact I think it should wait for the respond, but they implement add_policy() like this
// error intentionally ignored
this.watcher.update();
if (this.watcher) {
this.watcher.update();
}
}
}

Expand Down Expand Up @@ -163,7 +165,7 @@ export class InternalEnforcer extends CoreEnforcer {
}

if (useWatcher) {
if (this.watcher && this.autoNotifyWatcher) {
if (this.autoNotifyWatcher) {
// error intentionally ignored
if (this.watcherEx) {
this.watcherEx.updateForRemovePolicy(sec, ptype, ...rule);
Expand Down Expand Up @@ -203,7 +205,7 @@ export class InternalEnforcer extends CoreEnforcer {
}

if (useWatcher) {
if (this.watcher && this.autoNotifyWatcher) {
if (this.autoNotifyWatcher) {
// error intentionally ignored
if (this.watcherEx) {
this.watcherEx.updateForRemovePolicies(sec, ptype, ...rules);
Expand Down Expand Up @@ -241,7 +243,7 @@ export class InternalEnforcer extends CoreEnforcer {
}

if (useWatcher) {
if (this.watcher && this.autoNotifyWatcher) {
if (this.autoNotifyWatcher) {
// error intentionally ignored
if (this.watcherEx) {
this.watcherEx.updateForRemoveFilteredPolicy(sec, ptype, fieldIndex, ...fieldValues);
Expand Down

0 comments on commit 61c1595

Please sign in to comment.