Initial commit on Forgejo
Fresh repository history for elektrine/tarakan-client hosted at https://git.elektrine.com/elektrine/tarakan-client.
This commit is contained in:
commit
58b29a7f84
70 changed files with 12994 additions and 0 deletions
17
internal/api/run_id.go
Normal file
17
internal/api/run_id.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// NewRunID identifies one agent execution so network retries are idempotent
|
||||
// without treating independent executions as duplicates.
|
||||
func NewRunID() (string, error) {
|
||||
raw := make([]byte, 16)
|
||||
if _, err := rand.Read(raw); err != nil {
|
||||
return "", fmt.Errorf("generate run id: %w", err)
|
||||
}
|
||||
return "run_" + hex.EncodeToString(raw), nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue