public ModelVersion?incrementAndPublishNewModelVersion() { try { var lockResponse = client.Lock(name: MODEL_VERSION_LOCK, deadline: DateTime.UtcNow.AddMilliseconds(500)); var modelVersion = getModelVersion(); if (modelVersion.Version <= _modelVersion.Version) { _modelVersion.Version++; _modelVersion.TimeStamp = millis(); var json = serializeJson(_modelVersion); client.Put(MODEL_VERSION, json); } client.Unlock(MODEL_VERSION_LOCK); filterOutModelVersions(); return(_modelVersion); } catch (Exception e) { Console.WriteLine(e); throw; } return(null); }
public LockResponse Lock(LockRequest request) { var req = request.ToProto(); var rsp = client.Lock(req); return(rsp.FromProto()); }