You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
oabrivard 230de24e7c Added exercises source code 2 years ago
..
6-session-cleaner Added exercises source code 2 years ago
README.md Added exercises source code 2 years ago
check_test.go Added exercises source code 2 years ago
helper.go Added exercises source code 2 years ago
main.go Added exercises source code 2 years ago

README.md

Clean Inactive Sessions to Prevent Memory Overflow

Given is a SessionManager that stores session information in memory. The SessionManager itself is working, however, since we keep on adding new sessions to the manager our program will eventually run out of memory.

Your task is to implement a session cleaner routine that runs concurrently in the background and cleans every session that hasn't been updated for more than 5 seconds (of course usually session times are much longer).

Note that we expect the session to be removed anytime between 5 and 7 seconds after the last update. Also, note that you have to be very careful in order to prevent race conditions.

Test your solution

To complete this exercise, you must pass two test. The normal go test test cases as well as the race condition test.

Use the following commands to test your solution:

go test
go test --race