Handle collision case when generating hid
This commit is contained in:
parent
924924b10e
commit
29eefd7f5a
@ -18,8 +18,11 @@ namespace PluralKit {
|
||||
}
|
||||
|
||||
public async Task<PKSystem> Create(string systemName = null) {
|
||||
// TODO: handle HID collision case
|
||||
var hid = Utils.GenerateHid();
|
||||
string hid;
|
||||
do
|
||||
{
|
||||
hid = Utils.GenerateHid();
|
||||
} while (await GetByHid(hid) != null);
|
||||
|
||||
PKSystem system;
|
||||
using (var conn = await _conn.Obtain())
|
||||
@ -103,8 +106,11 @@ namespace PluralKit {
|
||||
}
|
||||
|
||||
public async Task<PKMember> Create(PKSystem system, string name) {
|
||||
// TODO: handle collision
|
||||
var hid = Utils.GenerateHid();
|
||||
string hid;
|
||||
do
|
||||
{
|
||||
hid = Utils.GenerateHid();
|
||||
} while (await GetByHid(hid) != null);
|
||||
|
||||
PKMember member;
|
||||
using (var conn = await _conn.Obtain())
|
||||
|
Loading…
Reference in New Issue
Block a user