Skip to content

Commit d56d870

Browse files
committed
More intelligent extraction
1 parent a1f2200 commit d56d870

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/Tracer/Tracer.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ public function assign(SpanContext $context): InjectableInterface
6060

6161
public function remove(SpanContext $context): InjectableInterface
6262
{
63-
if (0 === $this->stack->count()) {
64-
return $this;
65-
}
63+
while ($this->stack->valid()) {
64+
if (spl_object_hash($this->stack->top()) !== spl_object_hash($context)) {
65+
$this->stack->pop();
66+
continue;
67+
}
6668

67-
if (spl_object_hash($this->stack->top()) !== spl_object_hash($context)) {
68-
throw new \LogicException('Current context is different');
69+
break;
6970
}
70-
$this->stack->pop();
7171

7272
return $this;
7373
}

0 commit comments

Comments
 (0)