Skip to content

Commit a2fc65b

Browse files
committed
rename pushRingBuffer to processTasks
1 parent 17d8943 commit a2fc65b

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

orchagent/orch.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,16 +335,13 @@ void Consumer::execute()
335335
auto entries = std::make_shared<std::deque<KeyOpFieldsValuesTuple>>();
336336
getConsumerTable()->pops(*entries);
337337

338-
pushRingBuffer([=](){
338+
processTasks([=](){
339339
addToSync(entries);
340-
});
341-
342-
pushRingBuffer([=](){
343340
drain();
344341
});
345342
}
346343

347-
void Executor::pushRingBuffer(AnyTask&& task)
344+
void Executor::processTasks(AnyTask&& task)
348345
{
349346
if (!gRingBuffer || !gRingBuffer->thread_created)
350347
{

orchagent/orch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class Executor : public swss::Selectable
135135

136136
Orch *getOrch() const { return m_orch; }
137137
static std::shared_ptr<RingBuffer> gRingBuffer;
138-
void pushRingBuffer(AnyTask&& func);
138+
void processTasks(AnyTask&& func);
139139

140140
protected:
141141
swss::Selectable *m_selectable;

tests/mock_tests/orchdaemon_ut.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,18 @@ namespace orchdaemon_test
141141
EXPECT_FALSE(gRingBuffer->serves("OTHER_TABLE"));
142142

143143
int x = 0;
144-
route_consumer->pushRingBuffer([&](){x=3;});
145-
// verify `pushRingBuffer` is equivalent to executing the task immediately
144+
route_consumer->processTasks([&](){x=3;});
145+
// verify `processTasks` is equivalent to executing the task immediately
146146
EXPECT_TRUE(gRingBuffer->IsEmpty() && gRingBuffer->IsIdle() && !gRingBuffer->thread_created && x==3);
147147

148148
gRingBuffer->thread_created = true; // set the flag to assume the ring thread is created (actually not)
149149

150-
// verify `pushRingBuffer` is equivalent to executing the task immediately when ring is empty and idle
151-
other_consumer->pushRingBuffer([&](){x=4;});
150+
// verify `processTasks` is equivalent to executing the task immediately when ring is empty and idle
151+
other_consumer->processTasks([&](){x=4;});
152152
EXPECT_TRUE(gRingBuffer->IsEmpty() && gRingBuffer->IsIdle() && x==4);
153153

154-
route_consumer->pushRingBuffer([&](){x=5;});
155-
// verify `pushRingBuffer` would not execute the task if thread_created is true
154+
route_consumer->processTasks([&](){x=5;});
155+
// verify `processTasks` would not execute the task if thread_created is true
156156
// it only pushes the task to the ring buffer, without executing it
157157
EXPECT_TRUE(!gRingBuffer->IsEmpty() && x==4);
158158

0 commit comments

Comments
 (0)