From 1954f831cfeab50d4cb403d11d7c75e48886065a Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 27 Jan 2024 09:40:11 +0200 Subject: [PATCH] include pending data from pool --- src/controller/room.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/controller/room.php b/src/controller/room.php index 09c7ff6..909b5c5 100644 --- a/src/controller/room.php +++ b/src/controller/room.php @@ -149,7 +149,7 @@ class Room return null; } - // Get posts + // Get saved posts $posts = []; foreach ($records as $record) @@ -160,6 +160,34 @@ class Room } } + // Get pending posts + foreach ((array) $this->_kevacoin->kevaPending() as $pending) + { + // Ignore pending posts from other rooms + if ($pending['namespace'] != $namespace) + { + continue; + } + + // Ignore everything in pending queue but keva_put + if ($pending['op'] != 'keva_put') + { + continue; + } + + // Skip meta + if (str_starts_with($pending['key'], '_')) + { + continue; + } + + // Require valid kevachat post + if ($post = $this->_post($namespace, $pending['key'], $records, null, $time)) + { + $posts[$time] = $post; + } + } + // Sort posts by time krsort($posts);