Skip to content

Conversation

@laurenzlong
Copy link
Contributor

Description

Fixing a bug where database connections were being closed even if a function was invoked recently. I changed the model for ref counting, to only decrement the counter after waiting 2 minutes. Whereas the old model decremented the counter right away, and then waited 2 minutes to destroy the app. With the new changes, an app will only be destroyed if there's 2 minutes of no invocations.

Code sample

N/A

@laurenzlong laurenzlong requested a review from rjhuijsman April 10, 2017 22:50
Copy link
Contributor

@rjhuijsman rjhuijsman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach!

For my paranoia, could you add a test for each of these properties:

  1. Multiple retain() calls all increment the counter.
  2. Multiple release() calls spread apart in time each decrement the counter by only 1. In other words: for a refcount of 2, a release at T=0 and a release at T=30 means that cleanup happens at T=30+120=150, not at T=0+120.

@laurenzlong
Copy link
Contributor Author

Great test cases! Just added them.

Copy link
Contributor

@rjhuijsman rjhuijsman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran my repro with your branch installed. See the effect for yourself:
reefpgovmjl

:)

@laurenzlong laurenzlong merged commit 23da59e into master Apr 11, 2017
@laurenzlong laurenzlong deleted the ll-fixrefcounting branch April 11, 2017 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants