Skip to content

Commit f0f4f08

Browse files
committed
improve iplimit
1 parent b29bd99 commit f0f4f08

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

web/job/check_client_ip_job.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ func (j *CheckClientIpJob) processLogFile() bool {
151151
}
152152
sort.Strings(ips)
153153

154-
inboundClientIps, err := j.getInboundClientIps(email)
154+
clientIpsRecord, err := j.getInboundClientIps(email)
155155
if err != nil {
156156
j.addInboundClientIps(email, ips)
157157
continue
158158
}
159159

160-
shouldCleanLog = j.updateInboundClientIps(inboundClientIps, email, ips) || shouldCleanLog
160+
shouldCleanLog = j.updateInboundClientIps(clientIpsRecord, email, ips) || shouldCleanLog
161161
}
162162

163163
return shouldCleanLog
@@ -309,12 +309,12 @@ func (j *CheckClientIpJob) updateInboundClientIps(inboundClientIps *model.Inboun
309309

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

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

319-
return inbounds, nil
319+
return inbound, nil
320320
}

0 commit comments

Comments
 (0)