Gstaggregator and empty pad

I use muxer plugin based on gstaggregator class. I need to mux video, audio and metadata to file.
Main problem that metadata src element produses buffers every 2sec. As I checked, aggregator requires all pads to have data to mux. So as result I have freezes in my result video file every 2s.
What the way is to do it correcly?

In non-live mode aggregator requires (waits for) data on all pads.

In live mode (if upstream is live) it will timeout and move on if there’s no input data, based on the upstream latencies + configured extra-latency.

You can send GAP events in the metadata stream to tell aggregator that there won’t be any / hasn’t been any data for a while, then it will move on and process the other pads.

Thank you for reply.
I use gstreamer 1.18.4 and it’s gstaggregator takes into account mode of downstream element (as I checked in gstaggregator’s source code). I tryed to send latency querry from my metadata element but there wasn’t any effect.
In newer versions we can use gst_aggregator_set_ignore_inactive_pads or gst_aggregator_set_force_live functions to change behaviour, but I have to use 1.18.4.
About GAP events: what is logic of using GAP events?
I tryed to use
gst_pad_push_event (GST_BASE_TRANSFORM(self)->srcpad, gst_event_new_gap (pts, 2000000000));
to make a 2s gap, but it didn’t work for me. Maybe I did it wrong way?