Skip to content

添加key时的性能问题反馈 #370

@Mustang0394

Description

@Mustang0394

例行检查 / Checklist

  • 我已确认目前没有类似 issue (I have checked for similar issues)
  • 我已确认我已升级到最新版本 (I have updated to the latest version)
  • 我已完整查看过项目 README,尤其是常见问题部分 (I have read the README, especially the FAQ section)
  • 我理解并愿意跟进此 issue,协助测试和提供反馈 (I am willing to follow up on this issue, assist with testing, and provide feedback)
  • 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭 (I understand and agree to the above, and I understand that the maintainers have limited time, so issues that do not follow the rules may be ignored or closed directly)

问题描述 / Bug Description

if err := s.DB.Model(&models.APIKey{}).Where("group_id = ?", groupID).Pluck("key_hash", &existingHashes).Error; err != nil {

这行代码是直接扫group的全部key_hash,当同一group内的key达到一定数量级以后这步就会严重拖慢导入速度,并导致服务器高占用

复现步骤 / Steps to Reproduce

  1. 导入Key

预期结果 / Expected Behavior

导入key的时间保持稳定并且不会占用过多性能

相关截图 / Screenshots

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions