Skip to content

Commit

Permalink
improve iplimit
Browse files Browse the repository at this point in the history
  • Loading branch information
MHSanaei committed Dec 16, 2024
1 parent b29bd99 commit f0f4f08
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions web/job/check_client_ip_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ func (j *CheckClientIpJob) processLogFile() bool {
}
sort.Strings(ips)

inboundClientIps, err := j.getInboundClientIps(email)
clientIpsRecord, err := j.getInboundClientIps(email)
if err != nil {
j.addInboundClientIps(email, ips)
continue
}

shouldCleanLog = j.updateInboundClientIps(inboundClientIps, email, ips) || shouldCleanLog
shouldCleanLog = j.updateInboundClientIps(clientIpsRecord, email, ips) || shouldCleanLog
}

return shouldCleanLog
Expand Down Expand Up @@ -309,12 +309,12 @@ func (j *CheckClientIpJob) updateInboundClientIps(inboundClientIps *model.Inboun

func (j *CheckClientIpJob) getInboundByEmail(clientEmail string) (*model.Inbound, error) {
db := database.GetDB()
var inbounds *model.Inbound
inbound := &model.Inbound{}

err := db.Model(model.Inbound{}).Where("settings LIKE ?", "%"+clientEmail+"%").Find(&inbounds).Error
err := db.Model(&model.Inbound{}).Where("settings LIKE ?", "%"+clientEmail+"%").First(inbound).Error
if err != nil {
return nil, err
}

return inbounds, nil
return inbound, nil
}

1 comment on commit f0f4f08

@Shellgate
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

باگ جدید

Please sign in to comment.