Skip to content

Instantly share code, notes, and snippets.

@kinnalru
Created February 25, 2021 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kinnalru/95cafbcf89db97b0df5e1979bdda8b12 to your computer and use it in GitHub Desktop.
Save kinnalru/95cafbcf89db97b0df5e1979bdda8b12 to your computer and use it in GitHub Desktop.
Iframe embed example
Lusnoc::Mutex.new('/some/key').synchronize do |mx|
# do some work
mx.renew if mx.need_renew? # manualy renew session if needed
# do other work
mx.renew if mx.need_renew? # manualy renew session if needed
# ...
rescue Lusnoc::ExpiredError => e
# Session was invalidated and mutex was lost!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment