Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Always do count on buffer array not a good idea #120

Closed
omgnull opened this Issue Sep 20, 2012 · 0 comments

Comments

Projects
None yet
2 participants

omgnull commented Sep 20, 2012

This issue for all buffered handlers.

    $this->buffer[] = $record;
    if ($this->bufferSize > 0 && count($this->buffer) > $this->bufferSize) {
        array_shift($this->buffer);
    }

Better its shoud be independent counter and change the name "size" to "limit"

    $this->buffer[] = $record;
    $this->bufferSize++;
    if ($this->bufferLimit > 0 && $this->bufferSize === $this->bufferLimit) {
        array_shift($this->buffer);
        $this->bufferSize--;
    }

Or add option to flush records if buffer is full

@Seldaek Seldaek closed this in bcb51e0 Nov 11, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment