Skip to content

Commit 62a3111

Browse files
committed
Don't add a price to the list of pending updates if it is already present.
1 parent d22783d commit 62a3111

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pc/user.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "manager.hpp"
33
#include "log.hpp"
44
#include "mem_map.hpp"
5+
#include <algorithm>
56

67
#define PC_JSON_RPC_VER "2.0"
78
#define PC_JSON_PARSE_ERROR -32700
@@ -207,7 +208,9 @@ void user::parse_upd_price( uint32_t tok, uint32_t itok )
207208

208209
// Add the updated price to the pending updates
209210
sptr->update_no_send( price, conf, stype, false );
210-
pending_vec_.emplace_back( sptr );
211+
if( std::find(pending_vec_.begin(), pending_vec_.end(), sptr) == pending_vec_.end() ) {
212+
pending_vec_.emplace_back( sptr );
213+
}
211214

212215
// Send the result back
213216
add_header();

0 commit comments

Comments
 (0)