src/Web/Sessions/SessionArchiveInFiles.php
public function gc($lifeTime = 3600)
    {
        return $this->getArchivePath()->then(
            function($pathArchive) {
                $path = \Reaction::$app->fs->dir($pathArchive);
                return $path->ls();
            }
        )->then(
            function($list) use ($lifeTime) {
                $promises = [];
                $expiredTime = time() - $lifeTime;
                foreach ($list as $node) {
                    /** @var FileInterface $node */
                    if (!($node instanceof FileInterface)) {
                        continue;
                    }
                    $promises[] = $node->time()->then(
                        function($data) use ($expiredTime, $node) {
                            /** @var \DateTime $date */
                            $date = $data['mtime'];
                            if ($date->getTimestamp() < $expiredTime) {
                                return $node->remove()->then(null, function() {
                                    return true;
                                });
                            }
                            return true;
                        },
                        function() { return false; }
                    );
                }
                return !empty($promises) ? \Reaction\Promise\all($promises) : \Reaction\Promise\resolve(true);
            }
        )->then(null, function() {
            return \Reaction\Promise\resolve(false);
        });
    }
public function gc($lifeTime = 3600)
    {
        return $this->getArchivePath()->then(
            function($pathArchive) {
                $path = \Reaction::$app->fs->dir($pathArchive);
                return $path->ls();
            }
        )->then(
            function($list) use ($lifeTime) {
                $promises = [];
                $expiredTime = time() - $lifeTime;
                foreach ($list as $node) {
                    /** @var FileInterface $node */
                    if (!($node instanceof FileInterface)) {
                        continue;
                    }
                    $promises[] = $node->time()->then(
                        function($data) use ($expiredTime, $node) {
                            /** @var \DateTime $date */
                            $date = $data['mtime'];
                            if ($date->getTimestamp() < $expiredTime) {
                                return $node->remove()->then(null, function() {
                                    return true;
                                });
                            }
                            return true;
                        },
                        function() { return false; }
                    );
                }
                return !empty($promises) ? \Reaction\Promise\all($promises) : \Reaction\Promise\resolve(true);
            }
        )->then(null, function() {
            return \Reaction\Promise\resolve(false);
        });
    }
Garbage collector callback
@param int $lifeTime Session life time in archive
@return ExtendedPromiseInterface which resolved after process complete