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.

31 lines
778 B
Go

//////////////////////////////////////////////////////////////////////
//
// Your video processing service has a freemium model. Everyone has 10
// sec of free processing time on your service. After that, the
// service will kill your process, unless you are a paid premium user.
//
// Beginner Level: 10s max per request
// Advanced Level: 10s max per user (accumulated)
//
package main
// User defines the UserModel. Use this to check whether a User is a
// Premium user or not
type User struct {
ID int
IsPremium bool
TimeUsed int64 // in seconds
}
// HandleRequest runs the processes requested by users. Returns false
// if process had to be killed
func HandleRequest(process func(), u *User) bool {
process()
return true
}
func main() {
RunMockServer()
}