From 745d61f388aeb5618bd3f9dc91cc05728c90ce6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Mon, 1 Feb 2021 15:52:27 +0100 Subject: [PATCH] Fix cleanup threads to properly handle not found errors (#16797) Automatic Merge --- store/sqlstore/post_store.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/store/sqlstore/post_store.go b/store/sqlstore/post_store.go index ab21d0f001..ba8d521836 100644 --- a/store/sqlstore/post_store.go +++ b/store/sqlstore/post_store.go @@ -2106,7 +2106,8 @@ func (s *SqlPostStore) cleanupThreads(postId, rootId, userId string, permanent b if rootId != "" { thread, err := s.Thread().Get(rootId) if err != nil { - if err != sql.ErrNoRows { + var nfErr *store.ErrNotFound + if !errors.As(err, &nfErr) { return errors.Wrap(err, "failed to get a thread") } }