nessgor / telegraf-session-dynamodb

DynamoDB session middleware for Telegraf
MIT License
8 stars 4 forks source link

Support for TTL? #1

Closed lwl12 closed 5 years ago

lwl12 commented 5 years ago

https://github.com/telegraf/telegraf/blob/128aa04b9e0cc9b624a780dff99aa9155ccd9943/session.js#L7

nessgor commented 5 years ago

Please try feature/ttl

lwl12 commented 5 years ago

Sorry, I don't know how to use the beta branch... (New to NodeJS). But I think the default value -1 may cause the DynamoDB TTL not work properly.

Great thanks for your work!

nessgor commented 5 years ago

But I think the default value -1 may cause the DynamoDB TTL not work properly.

If the ttl value is set to -1, I have set up a conditional logic to omit the ttl field when updating the session. It will not update the ttl field to -1 in DynamoDB

nessgor commented 5 years ago

Sorry, I don't know how to use the beta branch... (New to NodeJS).

Uninstall the previous one, then try npm install git://github.com/nessgor/telegraf-session-dynamodb.git#feature/ttl --save

nessgor commented 5 years ago

@lwl12 Have you try the code? Does it work? I tried on my own dynamodb and the ttl is work.

lwl12 commented 5 years ago

Fantastic! I just used it in an amateur project, so I haven't had time to test it yet, I am very sorry for that. And I think it should work well!