Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
95cf37c5
Commit
95cf37c5
authored
Jan 23, 2017
by
Jason Song
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dramatically improve the apollo client unit test performance
parent
91f5b94c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
2 deletions
+33
-2
ConfigServiceLocator.java
...trip/framework/apollo/internals/ConfigServiceLocator.java
+1
-1
RemoteConfigRepository.java
...ip/framework/apollo/internals/RemoteConfigRepository.java
+1
-1
ConfigUtil.java
...main/java/com/ctrip/framework/apollo/util/ConfigUtil.java
+11
-0
BaseIntegrationTest.java
.../java/com/ctrip/framework/apollo/BaseIntegrationTest.java
+10
-0
RemoteConfigRepositoryTest.java
...ramework/apollo/internals/RemoteConfigRepositoryTest.java
+10
-0
No files found.
apollo-client/src/main/java/com/ctrip/framework/apollo/internals/ConfigServiceLocator.java
View file @
95cf37c5
...
...
@@ -131,7 +131,7 @@ public class ConfigServiceLocator implements Initializable {
}
try
{
TimeUnit
.
SECONDS
.
sleep
(
1
);
m_configUtil
.
getOnErrorRetryIntervalTimeUnit
().
sleep
(
m_configUtil
.
getOnErrorRetryInterval
()
);
}
catch
(
InterruptedException
ex
)
{
//ignore
}
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/internals/RemoteConfigRepository.java
View file @
95cf37c5
...
...
@@ -228,7 +228,7 @@ public class RemoteConfigRepository extends AbstractConfigRepository {
}
try
{
TimeUnit
.
SECONDS
.
sleep
(
1
);
m_configUtil
.
getOnErrorRetryIntervalTimeUnit
().
sleep
(
m_configUtil
.
getOnErrorRetryInterval
()
);
}
catch
(
InterruptedException
ex
)
{
//ignore
}
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/util/ConfigUtil.java
View file @
95cf37c5
...
...
@@ -29,6 +29,9 @@ public class ConfigUtil {
private
String
cluster
;
private
int
loadConfigQPS
=
2
;
//2 times per second
private
int
longPollQPS
=
2
;
//2 times per second
//for on error retry
private
long
onErrorRetryInterval
=
1
;
//1 second
private
TimeUnit
onErrorRetryIntervalTimeUnit
=
TimeUnit
.
SECONDS
;
//1 second
//for typed config cache of parser result, e.g. integer, double, long, etc.
private
long
maxConfigCacheSize
=
500
;
//500 cache key
private
long
configCacheExpireTime
=
1
;
//1 minute
...
...
@@ -212,6 +215,14 @@ public class ConfigUtil {
return
longPollQPS
;
}
public
long
getOnErrorRetryInterval
()
{
return
onErrorRetryInterval
;
}
public
TimeUnit
getOnErrorRetryIntervalTimeUnit
()
{
return
onErrorRetryIntervalTimeUnit
;
}
public
String
getDefaultLocalCacheDir
()
{
String
cacheRoot
=
isOSWindows
()
?
"C:\\opt\\data\\%s"
:
"/opt/data/%s"
;
return
String
.
format
(
cacheRoot
,
getAppId
());
...
...
apollo-client/src/test/java/com/ctrip/framework/apollo/BaseIntegrationTest.java
View file @
95cf37c5
...
...
@@ -182,6 +182,16 @@ public abstract class BaseIntegrationTest extends ComponentTestCase {
public
String
getDefaultLocalCacheDir
()
{
return
ClassLoaderUtil
.
getClassPath
();
}
@Override
public
long
getOnErrorRetryInterval
()
{
return
10
;
}
@Override
public
TimeUnit
getOnErrorRetryIntervalTimeUnit
()
{
return
TimeUnit
.
MILLISECONDS
;
}
}
/**
...
...
apollo-client/src/test/java/com/ctrip/framework/apollo/internals/RemoteConfigRepositoryTest.java
View file @
95cf37c5
...
...
@@ -233,6 +233,16 @@ public class RemoteConfigRepositoryTest extends ComponentTestCase {
public
int
getLongPollQPS
()
{
return
200
;
}
@Override
public
long
getOnErrorRetryInterval
()
{
return
10
;
}
@Override
public
TimeUnit
getOnErrorRetryIntervalTimeUnit
()
{
return
TimeUnit
.
MILLISECONDS
;
}
}
public
static
class
MockConfigServiceLocator
extends
ConfigServiceLocator
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment