MCPcopy
hub / github.com/loft-sh/devpod / initLock

Method initLock

pkg/client/clientimplementation/proxy_client.go:103–118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101}
102
103func (s *proxyClient) initLock() {
104 s.workspaceLockOnce.Do(func() {
105 s.m.Lock()
106 defer s.m.Unlock()
107
108 // get locks dir
109 workspaceLocksDir, err := provider.GetLocksDir(s.workspace.Context)
110 if err != nil {
111 panic(fmt.Errorf("get workspaces dir: %w", err))
112 }
113 _ = os.MkdirAll(workspaceLocksDir, 0777)
114
115 // create workspace lock
116 s.workspaceLock = flock.New(filepath.Join(workspaceLocksDir, s.workspace.ID+".workspace.lock"))
117 })
118}
119
120func (s *proxyClient) Provider() string {
121 return s.config.Name

Callers 2

LockMethod · 0.95
UnlockMethod · 0.95

Calls 4

GetLocksDirFunction · 0.92
LockMethod · 0.65
UnlockMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected