mirror of
https://github.com/github/semantic.git
synced 2024-11-28 18:23:44 +03:00
Remove user_id
This commit is contained in:
parent
87014ed03a
commit
bf2ed8a32a
@ -28,7 +28,6 @@ data ProcessData = ProcessUpdateData { gitDir :: String
|
||||
, program :: String
|
||||
, realIP :: Maybe String
|
||||
, repoName :: Maybe String
|
||||
, userID :: Maybe String
|
||||
, via :: String }
|
||||
| ProcessScheduleData
|
||||
| ProcessFinishData { cpu :: Integer
|
||||
@ -74,8 +73,8 @@ reportGitmon program gitCommand = do
|
||||
|
||||
reportGitmon' :: Socket -> String -> ReaderT LgRepo IO a -> ReaderT LgRepo IO a
|
||||
reportGitmon' soc program gitCommand = do
|
||||
(gitDir, realIP, repoName, userID) <- liftIO loadEnvVars
|
||||
safeIO $ sendAll soc (processJSON Update (ProcessUpdateData gitDir program realIP repoName userID "semantic-diff"))
|
||||
(gitDir, realIP, repoName) <- liftIO loadEnvVars
|
||||
safeIO $ sendAll soc (processJSON Update (ProcessUpdateData gitDir program realIP repoName "semantic-diff"))
|
||||
safeIO $ sendAll soc (processJSON Schedule ProcessScheduleData)
|
||||
shouldContinue error $ do
|
||||
(startTime, beforeProcIOContents) <- liftIO collectStats
|
||||
@ -110,14 +109,13 @@ reportGitmon' soc program gitCommand = do
|
||||
diskWriteBytes = afterDiskWriteBytes - beforeDiskWriteBytes
|
||||
resultCode = 0
|
||||
|
||||
loadEnvVars :: IO (String, Maybe String, Maybe String, Maybe String)
|
||||
loadEnvVars :: IO (String, Maybe String, Maybe String)
|
||||
loadEnvVars = do
|
||||
pwd <- getCurrentDirectory
|
||||
gitDir <- fromMaybe pwd <$> lookupEnv "GIT_DIR"
|
||||
realIP <- lookupEnv "GIT_SOCKSTAT_VAR_real_ip"
|
||||
repoName <- lookupEnv "GIT_SOCKSTAT_VAR_repo_name"
|
||||
userID <- lookupEnv "GIT_SOCKSTAT_VAR_user_id"
|
||||
pure (gitDir, realIP, repoName, userID)
|
||||
pure (gitDir, realIP, repoName)
|
||||
|
||||
-- Timeout in nanoseconds to wait before giving up on Gitmon response to schedule.
|
||||
gitmonTimeout :: Int
|
||||
|
@ -41,7 +41,6 @@ spec = parallel $ do
|
||||
withRepository lgFactory wd $ do
|
||||
liftIO $ setEnv "GIT_DIR" wd
|
||||
liftIO $ setEnv "GIT_SOCKSTAT_VAR_real_ip" "127.0.0.1"
|
||||
liftIO $ setEnv "GIT_SOCKSTAT_VAR_user_id" "1"
|
||||
liftIO $ setEnv "GIT_SOCKSTAT_VAR_repo_name" "examples/all-languages"
|
||||
|
||||
liftIO $ sendAll server "continue"
|
||||
@ -56,7 +55,6 @@ spec = parallel $ do
|
||||
liftIO $ shouldBe (either id program updateData) "cat-file"
|
||||
liftIO $ shouldBe (either Just realIP updateData) (Just "127.0.0.1")
|
||||
liftIO $ shouldBe (either Just repoName updateData) (Just "examples/all-languages")
|
||||
liftIO $ shouldBe (either Just userID updateData) (Just "1")
|
||||
liftIO $ shouldBe (either id via updateData) "semantic-diff"
|
||||
|
||||
liftIO $ shouldSatisfy (either (const (-1)) cpu finishData) (>= 0)
|
||||
@ -102,7 +100,7 @@ infoToData input = data' . toObject <$> Prelude.take 3 (split '\n' input)
|
||||
where data' = parseEither parser
|
||||
parser o = do
|
||||
dataO <- o .: "data"
|
||||
asum [ ProcessUpdateData <$> (dataO .: "git_dir") <*> (dataO .: "program") <*> (dataO .:? "real_ip") <*> (dataO .:? "repo_name") <*> (dataO .:? "user_id") <*> (dataO .: "via")
|
||||
asum [ ProcessUpdateData <$> (dataO .: "git_dir") <*> (dataO .: "program") <*> (dataO .:? "real_ip") <*> (dataO .:? "repo_name") <*> (dataO .: "via")
|
||||
, ProcessFinishData <$> (dataO .: "cpu") <*> (dataO .: "disk_read_bytes") <*> (dataO .: "disk_write_bytes") <*> (dataO .: "result_code")
|
||||
, pure ProcessScheduleData
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user