From 917b08a98cb310d05170d2ef3de9847419e3990e Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 8 Jul 2026 21:11:52 +0200 Subject: fixed bug regarding DEL --- handlers.go | 4 ++-- main.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/handlers.go b/handlers.go index 980e805..b4668f8 100644 --- a/handlers.go +++ b/handlers.go @@ -82,12 +82,12 @@ func handleDel(conn net.Conn, args []string) { conn.Write(serializeRESP(err)) return } - keys := args[:1] + keys := args[1:] deletedKeys := db.ExecuteMulti(keys, func(shards []*Shard) interface{}{ count := 0 for _, key := range keys{ shard := db.getShard(key) - _, exists := shard.data[key] + _, exists := shard.data[key] if exists { delete(shard.data, key) count += 1 diff --git a/main.go b/main.go index 2dc5b12..8acef78 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,7 @@ type handlerFunc func(net.Conn, []string) var commandRegistry = map[string]handlerFunc{ "GET": handleGet, "SET": handleSet, -// "DEL": handleDel, + "DEL": handleDel, "EXISTS": handleExists, /* "INCR": handleIncr, "DECR": handleDecr, -- cgit v1.2.3