Are not coming transaction after 20 min

Hi all, I have a problem for gets transactions, can You help? how are not coming transactions after 20 min in our Node. or are coming once in a big interval.
I use following code `.

pool.on(‘peerinv’, function (peer, message) {

//Inv Messages
message.inventory.forEach(function (inv) {
console.log(inv)
});

//Transactions
peer.sendMessage(messages.GetData(message.inventory));

    peer.on('tx', function (tx) {
        console.log(tx.transaction.id);
    });

//Address
peer.on(‘ready’, function () {
peer.sendMessage(messages.GetAddresses());
});
peer.on(‘addr’, function (info) {
info.addresses.forEach(function (addr) {
pool._connectPeer(addr);
});
});

    //Error
    peer.on('error', function (err) {
        console.log(err);
    });

});

thanks

That code looks OK. Do you have the latest version of Bitcoin Core, and is you blockchain synced?

Another comment: the following code is not necessary, the pool will auto-add new peers if you use it with the default configuration.

// this code is not necessary
peer.on('addr', function (info) {
  info.addresses.forEach(function (addr) {
  pool._connectPeer(addr);
  });
});