As explained in this thread:
the duration of time you are referring to is the value in milliseconds of the idle_timeout option. The default is 50 ms, which you experience as instantaneous and is too short for your use case. Change it to something bigger, for example 2 seconds:
set-option global idle_timeout 2000
and the behavior of your pluging should improve. See :doc options for more detailed info.