-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remaining number of seconds to midnight #4107
Comments
Help us here :-) what's the error? |
Hi @gquintard My bad, forgot the error message. Here you are: $ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
$ varnishd -V
varnishd (varnish-6.0.13 revision a395739fa63cddec305142eabefec0a4fd5339e7)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2024 Varnish Software
$ systemctl start varnish
$ journalctl -xu varnish
[...]
-- The job identifier is 4090832.
May 18 16:33:27 XXXX varnishd[29974]: Error:
May 18 16:33:27 XXXX varnishd[29974]: Message from VCC-compiler:
May 18 16:33:27 XXXX varnishd[29974]: Unknown argument 'duration'
May 18 16:33:27 XXXX varnishd[29974]: ('/etc/default.vcl' Line 187 Pos 55)
May 18 16:33:27 XXXX varnishd[29974]: set resp.http.X-Seconds-To-Midnight = std.integer(duration=std.time(regsub(now, "^(.+?)\d{2}:\d{2}:\d{2}(.+?)$", "\100:00:00\2")) + 1d
May 18 16:33:27 XXXX varnishd[29974]: ------------------------------------------------------########-----------------------------------------------------------------------------
May 18 16:33:27 XXXX varnishd[29974]: While compiling function call:
May 18 16:33:27 XXXX varnishd[29974]: ('/etc/default.vcl' Line 187 Pos 43) -- (Pos 54)
May 18 16:33:27 XXXX varnishd[29974]: set resp.http.X-Seconds-To-Midnight = std.integer(duration=std.time(regsub(now, "^(.+?)\d{2}:\d{2}:\d{2}(.+?)$", "\100:00:00\2")) + 1d
May 18 16:33:27 XXXX varnishd[29974]: ------------------------------------------############-------------------------------------------------------------------------------------
May 18 16:33:27 XXXX varnishd[29974]: Running VCC-compiler failed, exited with 2
May 18 16:33:27 XXXX varnishd[29974]: VCL compilation failed
May 18 16:33:27 XXXX systemd[1]: varnish.service: Control process exited, code=exited, status=255/EXCEPTION
-- Subject: Unit process exited Varnish Let me know if you need something else or you want me to perform any test. |
Thanks for that. It's just that on 6.0, that option doesn't exist: https://varnish-cache.org/docs/6.0/reference/vmod_generated.html You will need to either upgrade to something more recent, like 7.5, or use std.time2integer() |
Thanks @gquintard. I gonna try the Any reason why We were scared a bit to use |
7.5 isn't affected, so that's actually a great reason to use it :-) |
Expected Behavior
I'm trying to calculate the remaining number of seconds till midnight and use it in the
Cache-Control
HTTP header:Current Behavior
An error in the VCL when calling
duration
.Possible Solution
No response
Steps to Reproduce (for bugs)
No response
Context
I'm unable to use the function
std.integer(duration=...
Varnish Cache version
varnishd (varnish-6.0.13 revision a395739)
Operating system
Debian GNU/Linux 10 (buster)
Source of binary packages used (if any)
No response
The text was updated successfully, but these errors were encountered: