mirror of
https://github.com/github/semantic.git
synced 2024-12-01 09:15:01 +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
|
, program :: String
|
||||||
, realIP :: Maybe String
|
, realIP :: Maybe String
|
||||||
, repoName :: Maybe String
|
, repoName :: Maybe String
|
||||||
, userID :: Maybe String
|
|
||||||
, via :: String }
|
, via :: String }
|
||||||
| ProcessScheduleData
|
| ProcessScheduleData
|
||||||
| ProcessFinishData { cpu :: Integer
|
| ProcessFinishData { cpu :: Integer
|
||||||
@ -74,8 +73,8 @@ reportGitmon program gitCommand = do
|
|||||||
|
|
||||||
reportGitmon' :: Socket -> String -> ReaderT LgRepo IO a -> ReaderT LgRepo IO a
|
reportGitmon' :: Socket -> String -> ReaderT LgRepo IO a -> ReaderT LgRepo IO a
|
||||||
reportGitmon' soc program gitCommand = do
|
reportGitmon' soc program gitCommand = do
|
||||||
(gitDir, realIP, repoName, userID) <- liftIO loadEnvVars
|
(gitDir, realIP, repoName) <- liftIO loadEnvVars
|
||||||
safeIO $ sendAll soc (processJSON Update (ProcessUpdateData gitDir program realIP repoName userID "semantic-diff"))
|
safeIO $ sendAll soc (processJSON Update (ProcessUpdateData gitDir program realIP repoName "semantic-diff"))
|
||||||
safeIO $ sendAll soc (processJSON Schedule ProcessScheduleData)
|
safeIO $ sendAll soc (processJSON Schedule ProcessScheduleData)
|
||||||
shouldContinue error $ do
|
shouldContinue error $ do
|
||||||
(startTime, beforeProcIOContents) <- liftIO collectStats
|
(startTime, beforeProcIOContents) <- liftIO collectStats
|
||||||
@ -110,14 +109,13 @@ reportGitmon' soc program gitCommand = do
|
|||||||
diskWriteBytes = afterDiskWriteBytes - beforeDiskWriteBytes
|
diskWriteBytes = afterDiskWriteBytes - beforeDiskWriteBytes
|
||||||
resultCode = 0
|
resultCode = 0
|
||||||
|
|
||||||
loadEnvVars :: IO (String, Maybe String, Maybe String, Maybe String)
|
loadEnvVars :: IO (String, Maybe String, Maybe String)
|
||||||
loadEnvVars = do
|
loadEnvVars = do
|
||||||
pwd <- getCurrentDirectory
|
pwd <- getCurrentDirectory
|
||||||
gitDir <- fromMaybe pwd <$> lookupEnv "GIT_DIR"
|
gitDir <- fromMaybe pwd <$> lookupEnv "GIT_DIR"
|
||||||
realIP <- lookupEnv "GIT_SOCKSTAT_VAR_real_ip"
|
realIP <- lookupEnv "GIT_SOCKSTAT_VAR_real_ip"
|
||||||
repoName <- lookupEnv "GIT_SOCKSTAT_VAR_repo_name"
|
repoName <- lookupEnv "GIT_SOCKSTAT_VAR_repo_name"
|
||||||
userID <- lookupEnv "GIT_SOCKSTAT_VAR_user_id"
|
pure (gitDir, realIP, repoName)
|
||||||
pure (gitDir, realIP, repoName, userID)
|
|
||||||
|
|
||||||
-- Timeout in nanoseconds to wait before giving up on Gitmon response to schedule.
|
-- Timeout in nanoseconds to wait before giving up on Gitmon response to schedule.
|
||||||
gitmonTimeout :: Int
|
gitmonTimeout :: Int
|
||||||
|
@ -41,7 +41,6 @@ spec = parallel $ do
|
|||||||
withRepository lgFactory wd $ do
|
withRepository lgFactory wd $ do
|
||||||
liftIO $ setEnv "GIT_DIR" wd
|
liftIO $ setEnv "GIT_DIR" wd
|
||||||
liftIO $ setEnv "GIT_SOCKSTAT_VAR_real_ip" "127.0.0.1"
|
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 $ setEnv "GIT_SOCKSTAT_VAR_repo_name" "examples/all-languages"
|
||||||
|
|
||||||
liftIO $ sendAll server "continue"
|
liftIO $ sendAll server "continue"
|
||||||
@ -56,7 +55,6 @@ spec = parallel $ do
|
|||||||
liftIO $ shouldBe (either id program updateData) "cat-file"
|
liftIO $ shouldBe (either id program updateData) "cat-file"
|
||||||
liftIO $ shouldBe (either Just realIP updateData) (Just "127.0.0.1")
|
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 repoName updateData) (Just "examples/all-languages")
|
||||||
liftIO $ shouldBe (either Just userID updateData) (Just "1")
|
|
||||||
liftIO $ shouldBe (either id via updateData) "semantic-diff"
|
liftIO $ shouldBe (either id via updateData) "semantic-diff"
|
||||||
|
|
||||||
liftIO $ shouldSatisfy (either (const (-1)) cpu finishData) (>= 0)
|
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
|
where data' = parseEither parser
|
||||||
parser o = do
|
parser o = do
|
||||||
dataO <- o .: "data"
|
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")
|
, ProcessFinishData <$> (dataO .: "cpu") <*> (dataO .: "disk_read_bytes") <*> (dataO .: "disk_write_bytes") <*> (dataO .: "result_code")
|
||||||
, pure ProcessScheduleData
|
, pure ProcessScheduleData
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user