func InitializeLock() {
	if lockWorker == nil {
		lockWorker = new(lockWorkers)
		LockRequestHandler()
	}
}
InitializeLock - initializes the lockHandler
package utils
import (
	"fmt"
	"revproxy/v2/pkg/common"
	"sync"
	log "github.com/sirupsen/logrus"
)
const (
	LockRequestQueueLength = 100000
)
type LockRequest struct {
	ResourceID     string
	Unlock         bool
	WaitChannel    chan bool
	MaxOutStanding int
	MaxActive      int
}
type LockProperties struct {
	MaxActive      int
	MaxOutStanding int
	Active         int
	WaitChannel    chan chan bool
	Modified       bool
}
func (lockProp *LockProperties) Queue(request LockRequest) {
	if lockProp.MaxActive != request.MaxActive || lockProp.MaxOutStanding != request.MaxOutStanding {
		lockProp.Modified = true
	}
	if lockProp.Active < lockProp.MaxActive {
		lockProp.Active++
		request.WaitChannel <- true
	} else {
		select {
		case lockProp.WaitChannel <- request.WaitChannel:
			log.Infof("Request queued: %s\n", request.ResourceID)
		default:
			log.Infof("Max number of outstanding requests already queued for: %s\n", request.ResourceID)
			request.WaitChannel <- false
		}
	}
}
func (lockProp *LockProperties) Release(request LockRequest, fifoLocks map[string]*LockProperties) {
	if lockProp.Active == lockProp.MaxActive {
		select {
		case nextRequest := <-lockProp.WaitChannel:
			nextRequest <- true
		default:
			lockProp.Active--
		}
	} else {
		lockProp.Active--
	}
	if lockProp.Active == 0 && lockProp.Modified {
		deleteEntryFromMap(fifoLocks, request)
	}
}
func (lockProp *LockProperties) String() string {
	return fmt.Sprintf("Active(%d/%d), Queued(%d/%d)\n", lockProp.Active, lockProp.MaxActive,
		len(lockProp.WaitChannel), lockProp.MaxOutStanding)
}
func addEntryToMap(fifoLocks map[string]*LockProperties, request LockRequest) *LockProperties {
	lockProps := LockProperties{}
	lockProps.MaxActive = request.MaxActive
	lockProps.MaxOutStanding = request.MaxOutStanding
	lockProps.WaitChannel = make(chan chan bool, lockProps.MaxOutStanding)
	fifoLocks[request.ResourceID] = &lockProps
	return &lockProps
}
func deleteEntryFromMap(fifoLocks map[string]*LockProperties, request LockRequest) {
	lockProps, ok := fifoLocks[request.ResourceID]
	if ok {
		close(lockProps.WaitChannel)
		delete(fifoLocks, request.ResourceID)
	}
}
var lockMutex sync.Mutex
var lockRequestsQueue = make(chan LockRequest, LockRequestQueueLength)
type lockWorkers struct {
}
var lockWorker *lockWorkers