Index: impl/memory/taskqueue_data.go |
diff --git a/impl/memory/taskqueue_data.go b/impl/memory/taskqueue_data.go |
index 5ecd3ee12ed91c4662ca9d7ac7f3a42e58fd0ecb..bf21954d1437be37615cb71f4dce05ebf3607996 100644 |
--- a/impl/memory/taskqueue_data.go |
+++ b/impl/memory/taskqueue_data.go |
@@ -63,13 +63,9 @@ func newSortedQueue(name string, isPullQueue bool) *sortedQueue { |
// All sortedQueue methods are assumed to be called under taskQueueData lock. |
func (q *sortedQueue) genTaskName(c context.Context) string { |
- const validTaskChars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_" |
for { |
- buf := [500]byte{} |
- for i := 0; i < 500; i++ { |
- buf[i] = validTaskChars[mathrand.Intn(c, len(validTaskChars))] |
- } |
- name := string(buf[:]) |
+ // Real Task Queue service seems to be using random ints too. |
+ name := fmt.Sprintf("%d", mathrand.Int63(c)) |
_, ok1 := q.tasks[name] |
_, ok2 := q.archived[name] |
if !ok1 && !ok2 { |