don't try to replace policies for deleted shares (#276)

This commit is contained in:
Michael Quigley 2023-03-28 15:05:51 -04:00
parent 31819b42ba
commit bd4ce22d97
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
3 changed files with 51 additions and 45 deletions

View File

@ -33,6 +33,7 @@ func (a *accountRelaxAction) HandleAccount(acct *store.Account, _, _ int64, _ *B
}
for _, shr := range shrs {
if !shr.Deleted {
if shr.ShareMode == "public" {
env, err := a.str.GetEnvironment(shr.EnvironmentId, trx)
if err != nil {
@ -54,6 +55,7 @@ func (a *accountRelaxAction) HandleAccount(acct *store.Account, _, _ int64, _ *B
}
}
}
}
return nil
}

View File

@ -27,6 +27,7 @@ func (a *environmentRelaxAction) HandleEnvironment(env *store.Environment, rxByt
}
for _, shr := range shrs {
if !shr.Deleted {
if shr.ShareMode == "public" {
env, err := a.str.GetEnvironment(shr.EnvironmentId, trx)
if err != nil {
@ -47,6 +48,7 @@ func (a *environmentRelaxAction) HandleEnvironment(env *store.Environment, rxByt
return errors.New("share relax for private share not implemented")
}
}
}
return nil
}

View File

@ -21,6 +21,7 @@ func newShareRelaxAction(str *store.Store, edge *rest_management_api_client.Ziti
func (a *shareRelaxAction) HandleShare(shr *store.Share, rxBytes, txBytes int64, limit *BandwidthPerPeriod, trx *sqlx.Tx) error {
logrus.Infof("relaxing '%v'", shr.Token)
if !shr.Deleted {
if shr.ShareMode == "public" {
env, err := a.str.GetEnvironment(shr.EnvironmentId, trx)
if err != nil {
@ -40,6 +41,7 @@ func (a *shareRelaxAction) HandleShare(shr *store.Share, rxBytes, txBytes int64,
} else if shr.ShareMode == "private" {
return errors.New("share relax for private share not implemented")
}
}
return nil
}