Because you’re scheduling the event – even though it’s set to run immediately (i.e. with time()
), it won’t fire until a second request.
So that log output is entirely expected. Try running it again, removing the code, then run once more – you should get:
[time] test_action