but should we really be changing expressed functions to declared functions?
is the other thing
nedry_
I've written a plugin that uses redis and when I restart haraka the entire database (4) gets wiped, as though the the flushdb command was executed. Any ideas why this would happen?
anosh
That's weird
does your plugin do something on shutdown?
nedry_
if (this.db) this.db.quit();
anosh
idk then
nedry_
Hmmm, it's not just my database (4) that is getting wiped. The greylist plugin's database (3) is also getting wiped.
doublemalt_ joined the channel
ultimatt joined the channel
ultimatt
nedry_, check your redis logs and make sure there aren't errors regarding redis' ability to write out the DB file
EyePulp
nedry_: Are you actually writing your redis instance data someplace?
ultimatt
anosh, regarding function expressions vs declarations.
Prior to replacing var with const/let, the difference was moot. Personal preference really.
However, since deprecating var repo wide, there now is a difference.
function declarations are still hoisted (same as before) but function expressions no longer are, when assigned to const/let
Now, I already went through and cleaned up all the instances where that behavior change broke code.
At least, so far we haven't found any I missed.
anosh
yeah, I kind of figured that, I forgot about the const/let change
ultimatt
But, as a matter of course, unless there's a good reason to choose expressions, we should prefer function declarations.
anosh
why is `export.name = func` not seen as a function expression?
ultimatt
it is a function expression, but it's rather unavoidable, without declaring all your functions and then separately exporting them.
Maybe we want to do that, but that's a separate issue.
anosh
Nah yeah, but it's more of why the linter isn't picking it up? Then again I've just skimmed through the PR haha
ultimatt
Not sure, but I'd guess it's because of the "a few things MUST have trailing semicolons" issue, and that those look similar.
anosh
weird
ultimatt
eslint has been terrific as a dev tool primarily because unlike it's predecessors, it knows it's limits and stays back from them a couple steps.
For example, it was able to autofix most of the var -> const/let changes, except in cases where the scope changes were likely to cause issues.
anosh: for example, greylisting records in redis are nice to have stick around in case you have to restart your redis instance that stores them.
anosh
👌
ultimatt
sender reputation data, ASN owners, the sort of stuff that is looked up often and changes infrequently should persist
but IIRC, redis persists across restarts by defau.t
baudehlo
Yeah it dumps once an hour
nedry_
Redis should also save data when it is shutdown
It looks like redis is saving my databases at /var/lib/redis/dump.rdb
Using the strings command, I can see my plugin's records in that file, so yes EyePulp, my data is getting written to disk.
EyePulp
nedry_: then I suspect you've got some logic somewhere clearing out the data on restart. Or your using keys in conflict with something else that's clearing them out. Is your plugin code visible anywhere for us to look at?
s/your/you're
And more broadly, there's nothing in haraka that pro-actively clears out unexpected redis keys, right?