mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-01 06:36:38 +08:00
refactor(idgen): centralize negative ID handling via panic
Restore NextUint64ID() to uint64-only API so callers need no error checks. Retry logic stays in idgen; after 3 negative values it panics instead of returning 0, preventing silent NULL primary keys.
This commit is contained in:
@@ -387,10 +387,8 @@ func TestRetryTaskNonExistent(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGenerateTaskID(t *testing.T) {
|
||||
id1, err := generateTaskID("test_type", "manual")
|
||||
require.NoError(t, err)
|
||||
id2, err := generateTaskID("test_type", "manual")
|
||||
require.NoError(t, err)
|
||||
id1 := generateTaskID("test_type", "manual")
|
||||
id2 := generateTaskID("test_type", "manual")
|
||||
|
||||
// 两个 ID 应不同(包含 Snowflake ID)
|
||||
assert.NotEqual(t, id1, id2)
|
||||
|
||||
Reference in New Issue
Block a user