Skip to content

Large volume of transactions causes memory depletion #54

@Nerahikada

Description

@Nerahikada

If the database server is slow and takes a long time to process transactions, attempting to process a large number of transactions will create a large number of connections and cause the server to crash due to lack of memory.

Using slow database, you can reproduce it with code like this

use SOFe\Capital\{Capital, CapitalException, LabelSet};

Capital::api("0.1.0", function(Capital $api){
    $this->selector = $api->completeConfig(["currency" => "money"]);
});

$this->getScheduler()->scheduleRepeatingTask(new ClosureTask(function(){
    foreach($this->getServer()->getOnlinePlayers() as $player){
        Capital::api("0.1.0", function(Capital $api) use ($player){
            yield from $api->addMoney($this->getName(), $player, $this->selector, 1, new LabelSet([]));
        });
    }
}), 1);

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions