Essa empresa é sua?
code in the language of your choice: A site has 4,320,000 users. The users are sequentially numbered -- each user has a user_id between 1 and 4320000. You want to slowly roll out a new feature to all users, at a consistent rate of X users per second. The roll-out should start at noon today, beginning with the newest user (id 4320000). The rollout should last two days, so user_id 1 gets the feature around noon two days from now. $Write a function to determine whether the feature is currently enabled for a given user_id: can_use_new_feature(int user_id) -> bool.
Sigiloso
Total seconds in 2 days = 172800 Divide total users 4320000/172800(seconds) = 25 users processed every second global start_time = unix_timestamp(start date noon) global users_per_second = 25 global total_users = 4320000 function can_use_new_feature(user_id) { var current_timestamp = unix_timestamp(current_time) var elapsed_seconds = timestamp_diff_to_seconds(current_timestamp, start_time) var processed_users = total_users - (users_per_second * elapsed_seconds) return (bool) user_id >=processed_users }