Skip to content

Commit

Permalink
Merge pull request #1993 from slntopp/dev
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
coddmeistr authored Feb 6, 2025
2 parents dce270a + a1062cb commit e4ff89f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/billing/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"golang.org/x/sync/errgroup"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"runtime/debug"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -207,7 +208,7 @@ func (s *BillingServiceServer) dailyCronJobAction(ctx context.Context, log *zap.
log = log.Named("Action")
defer func() {
if err := recover(); err != nil {
log.Error("Recovered from panic", zap.Any("err", err))
log.Error("Recovered from panic", zap.Any("err", err), zap.String("stacktrace", string(debug.Stack())))
}
}()
// Jobs
Expand Down
6 changes: 6 additions & 0 deletions pkg/billing/cron_delete_orphan_vpn_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,16 @@ func (s *BillingServiceServer) DeleteOrphanVPNInstances(ctx context.Context, log
}
inst := obj.Instance
log := log.With(zap.String("instance", inst.GetUuid()))
if inst.GetStatus() == statuspb.NoCloudStatus_DEL {
continue
}
if inst.BillingPlan == nil || inst.Config == nil {
continue
}
plan := plans[inst.GetBillingPlan().GetUuid()]
if plan == nil {
continue
}
if strings.ToLower(plan.Type) != "vpn" {
continue
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/billing/cron_send_services_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ func formatWhmcsLastLogin(data string) (date string, ip string, host string) {
} else if strings.HasPrefix(strings.TrimSpace(part), "IP Address:") {
ip = strings.TrimSpace(strings.TrimPrefix(strings.TrimSpace(part), "IP Address:"))
} else if strings.HasPrefix(strings.TrimSpace(part), "Host:") {
ip = strings.TrimSpace(strings.TrimPrefix(strings.TrimSpace(part), "Host:"))
host = strings.TrimSpace(strings.TrimPrefix(strings.TrimSpace(part), "Host:"))
}
}
return
Expand Down

0 comments on commit e4ff89f

Please sign in to comment.