From cc777ebdaa62b69bd6e985fa97117b854e7d1cd6 Mon Sep 17 00:00:00 2001 From: cui fliter Date: Thu, 5 Jan 2023 15:23:05 +0800 Subject: [PATCH] fix some typos Signed-off-by: cui fliter --- README.md | 2 +- heartbeat_test.go | 4 ++-- internal/rdb/rdb.go | 8 ++++---- internal/testutil/testutil.go | 2 +- recoverer.go | 2 +- tools/asynq/cmd/dash/draw.go | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 31e9cf4..b399673 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Task queues are used as a mechanism to distribute work across multiple machines. **Status**: The library is currently undergoing **heavy development** with frequent, breaking API changes. -> ☝️ **Important Note**: Current major version is zero (`v0.x.x`) to accomodate rapid development and fast iteration while getting early feedback from users (_feedback on APIs are appreciated!_). The public API could change without a major version update before `v1.0.0` release. +> ☝️ **Important Note**: Current major version is zero (`v0.x.x`) to accommodate rapid development and fast iteration while getting early feedback from users (_feedback on APIs are appreciated!_). The public API could change without a major version update before `v1.0.0` release. ## Quickstart diff --git a/heartbeat_test.go b/heartbeat_test.go index ec75ace..1c423bc 100644 --- a/heartbeat_test.go +++ b/heartbeat_test.go @@ -22,7 +22,7 @@ import ( // Test goes through a few phases. // // Phase1: Simulate Server startup; Simulate starting tasks listed in startedWorkers -// Phase2: Simluate finishing tasks listed in finishedTasks +// Phase2: Simulate finishing tasks listed in finishedTasks // Phase3: Simulate Server shutdown; func TestHeartbeater(t *testing.T) { r := setup(t) @@ -41,7 +41,7 @@ func TestHeartbeater(t *testing.T) { t5 := h.NewTaskMessageWithQueue("task5", nil, "custom") t6 := h.NewTaskMessageWithQueue("task6", nil, "default") - // Note: intentionally set to time less than now.Add(rdb.LeaseDuration) to test lease extention is working. + // Note: intentionally set to time less than now.Add(rdb.LeaseDuration) to test lease extension is working. lease1 := h.NewLeaseWithClock(now.Add(10*time.Second), clock) lease2 := h.NewLeaseWithClock(now.Add(10*time.Second), clock) lease3 := h.NewLeaseWithClock(now.Add(10*time.Second), clock) diff --git a/internal/rdb/rdb.go b/internal/rdb/rdb.go index bfe4ea3..5d8b595 100644 --- a/internal/rdb/rdb.go +++ b/internal/rdb/rdb.go @@ -67,7 +67,7 @@ func (r *RDB) runScript(ctx context.Context, op errors.Op, script *redis.Script, return nil } -// Runs the given script with keys and args and retuns the script's return value as int64. +// Runs the given script with keys and args and returns the script's return value as int64. func (r *RDB) runScriptWithErrorCode(ctx context.Context, op errors.Op, script *redis.Script, keys []string, args ...interface{}) (int64, error) { res, err := script.Run(ctx, r.client, keys, args...).Result() if err != nil { @@ -368,7 +368,7 @@ func (r *RDB) Done(ctx context.Context, msg *base.TaskMessage) error { // // ARGV[1] -> task ID // ARGV[2] -> stats expiration timestamp -// ARGV[3] -> task exipration time in unix time +// ARGV[3] -> task expiration time in unix time // ARGV[4] -> task message data // ARGV[5] -> max int64 value var markAsCompleteCmd = redis.NewScript(` @@ -405,7 +405,7 @@ return redis.status_reply("OK") // // ARGV[1] -> task ID // ARGV[2] -> stats expiration timestamp -// ARGV[3] -> task exipration time in unix time +// ARGV[3] -> task expiration time in unix time // ARGV[4] -> task message data // ARGV[5] -> max int64 value var markAsCompleteUniqueCmd = redis.NewScript(` @@ -1086,7 +1086,7 @@ const aggregationTimeout = 2 * time.Minute // The time for gracePeriod and maxDelay is computed relative to the time t. // // Note: It assumes that this function is called at frequency less than or equal to the gracePeriod. In other words, -// the function only checks the most recently added task aganist the given gracePeriod. +// the function only checks the most recently added task against the given gracePeriod. func (r *RDB) AggregationCheck(qname, gname string, t time.Time, gracePeriod, maxDelay time.Duration, maxSize int) (string, error) { var op errors.Op = "RDB.AggregationCheck" aggregationSetID := uuid.NewString() diff --git a/internal/testutil/testutil.go b/internal/testutil/testutil.go index 33a87f4..899dfb1 100644 --- a/internal/testutil/testutil.go +++ b/internal/testutil/testutil.go @@ -252,7 +252,7 @@ func SeedLease(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname s seedRedisZSet(tb, r, base.LeaseKey(qname), entries, base.TaskStateActive) } -// SeedCompletedQueue initializes the completed set witht the given entries. +// SeedCompletedQueue initializes the completed set with the given entries. func SeedCompletedQueue(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname string) { tb.Helper() r.SAdd(context.Background(), base.AllQueues, qname) diff --git a/recoverer.go b/recoverer.go index c7a41dd..e350aa7 100644 --- a/recoverer.go +++ b/recoverer.go @@ -87,7 +87,7 @@ func (r *recoverer) recover() { } func (r *recoverer) recoverLeaseExpiredTasks() { - // Get all tasks which have expired 30 seconds ago or earlier to accomodate certain amount of clock skew. + // Get all tasks which have expired 30 seconds ago or earlier to accommodate certain amount of clock skew. cutoff := time.Now().Add(-30 * time.Second) msgs, err := r.broker.ListLeaseExpired(cutoff, r.queues...) if err != nil { diff --git a/tools/asynq/cmd/dash/draw.go b/tools/asynq/cmd/dash/draw.go index b53349e..6b43bc7 100644 --- a/tools/asynq/cmd/dash/draw.go +++ b/tools/asynq/cmd/dash/draw.go @@ -446,7 +446,7 @@ func nextTaskState(current asynq.TaskState) asynq.TaskState { } } } - panic("unkown task state") + panic("unknown task state") } func prevTaskState(current asynq.TaskState) asynq.TaskState { @@ -459,7 +459,7 @@ func prevTaskState(current asynq.TaskState) asynq.TaskState { } } } - panic("unkown task state") + panic("unknown task state") } func getTaskCount(queue *asynq.QueueInfo, taskState asynq.TaskState) int {