2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-10-26 11:16:12 +08:00

Use int as priority value type.

Do not use unsigned int for merely non-negative quantities as it
complicates simple arithmetic.
This commit is contained in:
Ken Hibino
2020-02-12 22:23:25 -08:00
parent bf31fcc3ec
commit d33ca98648
15 changed files with 84 additions and 70 deletions

View File

@@ -245,10 +245,10 @@ func reverse(x []string) {
// for the list operation.
type Pagination struct {
// Number of items in the page.
Size uint
Size int
// Page number starting from zero.
Page uint
Page int
}
func (p Pagination) start() int64 {

View File

@@ -317,8 +317,8 @@ func TestListEnqueuedPagination(t *testing.T) {
tests := []struct {
desc string
qname string
page uint
size uint
page int
size int
wantSize int
wantFirst string
wantLast string
@@ -418,8 +418,8 @@ func TestListInProgressPagination(t *testing.T) {
tests := []struct {
desc string
page uint
size uint
page int
size int
wantSize int
wantFirst string
wantLast string
@@ -524,8 +524,8 @@ func TestListScheduledPagination(t *testing.T) {
tests := []struct {
desc string
page uint
size uint
page int
size int
wantSize int
wantFirst string
wantLast string
@@ -667,8 +667,8 @@ func TestListRetryPagination(t *testing.T) {
tests := []struct {
desc string
page uint
size uint
page int
size int
wantSize int
wantFirst string
wantLast string
@@ -800,8 +800,8 @@ func TestListDeadPagination(t *testing.T) {
tests := []struct {
desc string
page uint
size uint
page int
size int
wantSize int
wantFirst string
wantLast string
@@ -2056,7 +2056,7 @@ func TestListProcesses(t *testing.T) {
ps1 := &base.ProcessInfo{
Concurrency: 10,
Queues: map[string]uint{"default": 1},
Queues: map[string]int{"default": 1},
Host: "do.droplet1",
PID: 1234,
State: "running",
@@ -2066,7 +2066,7 @@ func TestListProcesses(t *testing.T) {
ps2 := &base.ProcessInfo{
Concurrency: 20,
Queues: map[string]uint{"email": 1},
Queues: map[string]int{"email": 1},
Host: "do.droplet2",
PID: 9876,
State: "stopped",

View File

@@ -745,7 +745,7 @@ func TestReadWriteClearProcessInfo(t *testing.T) {
r := setup(t)
pinfo := &base.ProcessInfo{
Concurrency: 10,
Queues: map[string]uint{"default": 2, "email": 5, "low": 1},
Queues: map[string]int{"default": 2, "email": 5, "low": 1},
PID: 98765,
Host: "localhost",
State: "running",