Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
GMPhobos
Project
Project
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMPhobos
Commits
98e8d83e
Commit
98e8d83e
authored
Oct 17, 2016
by
翟国钧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改实时发送埋点之后的缓存数据处理的逻辑,实时发送数据成功之后,不清除缓存数据
parent
eb165a7c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
Phobos.m
Pod/Classes/Phobos.m
+15
-12
No files found.
Pod/Classes/Phobos.m
View file @
98e8d83e
...
@@ -219,7 +219,7 @@ static NSString *sdkVersion = @"110";
...
@@ -219,7 +219,7 @@ static NSString *sdkVersion = @"110";
NSArray
*
array
=
[[
WMCacheService
sharedInstance
]
fetchObjectAtDiskWithkey
:
PhobosCacheKey
];
NSArray
*
array
=
[[
WMCacheService
sharedInstance
]
fetchObjectAtDiskWithkey
:
PhobosCacheKey
];
//超过一定数量的话,统一发送一次
//超过一定数量的话,统一发送一次
if
(
array
.
count
>
PhobosShardCount
)
{
if
(
array
.
count
>
PhobosShardCount
)
{
[
sharedClient
sendArray
:
array
];
[
sharedClient
sendArray
:
array
cleanCacheRightNow
:
YES
];
}
}
}
}
...
@@ -227,7 +227,8 @@ static NSString *sdkVersion = @"110";
...
@@ -227,7 +227,8 @@ static NSString *sdkVersion = @"110";
NSDictionary
*
dict
=
[
sharedClient
prepareDictionaryForEvent
:
eventId
attributes
:
attributes
];
NSDictionary
*
dict
=
[
sharedClient
prepareDictionaryForEvent
:
eventId
attributes
:
attributes
];
if
(
sendNow
)
{
if
(
sendNow
)
{
NSArray
*
array
=
@[
dict
];
NSArray
*
array
=
@[
dict
];
[
sharedClient
sendArray
:
array
];
// 实时发送的埋点,不能立即清楚缓存
[
sharedClient
sendArray
:
array
cleanCacheRightNow
:
NO
];
}
else
{
}
else
{
[
sharedClient
save
:
dict
];
[
sharedClient
save
:
dict
];
}
}
...
@@ -364,18 +365,18 @@ static NSString *sdkVersion = @"110";
...
@@ -364,18 +365,18 @@ static NSString *sdkVersion = @"110";
-
(
void
)
fetchDataAndSend
{
-
(
void
)
fetchDataAndSend
{
NSArray
*
paramsArray
=
[[
WMCacheService
sharedInstance
]
fetchObjectAtDiskWithkey
:
PhobosCacheKey
];
NSArray
*
paramsArray
=
[[
WMCacheService
sharedInstance
]
fetchObjectAtDiskWithkey
:
PhobosCacheKey
];
if
(
paramsArray
.
count
>
0
)
{
if
(
paramsArray
.
count
>
0
)
{
[
self
sendArray
:
paramsArray
];
[
self
sendArray
:
paramsArray
cleanCacheRightNow
:
YES
];
}
}
}
}
/**
/**
* @brief 发送数组
向Mars发送埋点数据,如果是实时发送的,http请求成功之后,不清楚已有的缓存数据。
*
针对普通埋点数据,发送成功之后,立即删除本地的缓存。
* @param array
@author zhaiguojun 16-10-17 in (null)
*
@param array 参数
* @since 0.0.1
@param now 是否立即清楚缓存
*/
*/
-
(
void
)
sendArray
:
(
NSArray
*
)
array
{
-
(
void
)
sendArray
:
(
NSArray
*
)
array
cleanCacheRightNow
:
(
BOOL
)
clean
{
if
(
_logEnabled
)
{
if
(
_logEnabled
)
{
phobosLog
([
NSString
stringWithFormat
:
@"array prepare to fly --✈: %@"
,
array
]);
phobosLog
([
NSString
stringWithFormat
:
@"array prepare to fly --✈: %@"
,
array
]);
}
}
...
@@ -385,7 +386,9 @@ static NSString *sdkVersion = @"110";
...
@@ -385,7 +386,9 @@ static NSString *sdkVersion = @"110";
if
(
compressedData
)
{
if
(
compressedData
)
{
[
PhobosUtil
sendData
:
compressedData
success
:
^
(
NSInteger
code
)
{
[
PhobosUtil
sendData
:
compressedData
success
:
^
(
NSInteger
code
)
{
phobosLog
(
@"✈ ---------- ✈ data arrived Mars"
);
phobosLog
(
@"✈ ---------- ✈ data arrived Mars"
);
[[
WMCacheService
sharedInstance
]
removeObjectAtDiskWithkey
:
PhobosCacheKey
];
if
(
clean
)
{
[[
WMCacheService
sharedInstance
]
removeObjectAtDiskWithkey
:
PhobosCacheKey
];
}
}];
}];
}
}
}
}
...
@@ -460,5 +463,4 @@ static NSString *sdkVersion = @"110";
...
@@ -460,5 +463,4 @@ static NSString *sdkVersion = @"110";
}
}
}
}
@end
@end
\ No newline at end of file
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