3 ms·
Perhaps, but mongodb was responsible for something I have bookmarked as "the worst line of code ever". Which decided whether or not to log connection warnings
by dralley 5y ago
Perhaps, but mongodb was responsible for something I have bookmarked as "the worst line of code ever".
Which decided whether or not to log connection warnings based on Math.random()
https://github.com/mongodb/mongo-java-driver/blob/1d2e6faa80aeb5287a26d0348f18f4b51d566759/src/main/com/mongodb/ConnectionStatus.java#L212-L215 https://github.com/mongodb/mongo-java-driver/blob/1d2e6faa80...
- threeseed 5y agoa) This is a line of code from 2013 and was fixed weeks after. b) Based on the JIRA [1] it was designed to only log 10% of subsequent failures where there is no connection to prevent log flooding. You would still get the initial failure message. Pretty reasonable technique and hardly the worst code ever. [1] https://jira.mongodb.org/browse/JAVA-836 https://jira.mongodb.org/browse/JAVA-836