Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArsentiy Milchakov <milcars@mapswithme.com>2017-08-22 15:01:26 +0300
committerVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2017-09-13 16:25:29 +0300
commitab79980e3d5730afe430e5b64f7a11c14a513f0a (patch)
tree4adee5e2809ba45cdfebf9ddec2821cadf55ccee /storage
parent1eb176f6fefa4f0dfac0ce82865efafedb09655c (diff)
marketing events
Diffstat (limited to 'storage')
-rw-r--r--storage/diff_scheme/diff_manager.cpp17
-rw-r--r--storage/diff_scheme/diff_scheme_checker.cpp9
-rw-r--r--storage/storage.cpp2
3 files changed, 19 insertions, 9 deletions
diff --git a/storage/diff_scheme/diff_manager.cpp b/storage/diff_scheme/diff_manager.cpp
index 1fbd6bcf21..b5508ed2ed 100644
--- a/storage/diff_scheme/diff_manager.cpp
+++ b/storage/diff_scheme/diff_manager.cpp
@@ -31,7 +31,8 @@ void Manager::Load(LocalMapsInfo && info)
if (diffs.empty())
{
m_status = Status::NotAvailable;
- // TODO: Log fall back to the old scheme (Downloader_DiffScheme_OnStart_fallback (Aloha)).
+
+ GetPlatform().GetMarketingService().SendMarketingEvent(marketing::kDiffSchemeFallback, {});
}
else
{
@@ -40,8 +41,7 @@ void Manager::Load(LocalMapsInfo && info)
auto & observers = m_observers;
auto status = m_status;
- GetPlatform().RunOnGuiThread([observers, status]() mutable
- {
+ GetPlatform().RunOnGuiThread([observers, status]() mutable {
observers.ForEach(&Observer::OnDiffStatusReceived, status);
});
});
@@ -62,13 +62,14 @@ void Manager::ApplyDiff(ApplyDiffParams && p, std::function<void(bool const resu
diffFile->SyncWithDisk();
auto const isOnDisk = diffFile->OnDisk(MapOptions::Diff);
+ auto const isFilePrepared = isOnDisk || my::RenameFileX(diffReadyPath, diffPath);
- if (isOnDisk || my::RenameFileX(diffReadyPath, diffPath))
+ if (isFilePrepared)
{
// Sync with disk after renaming.
if (!isOnDisk)
diffFile->SyncWithDisk();
-
+
string const oldMwmPath = p.m_oldMwmFile->GetPath(MapOptions::Map);
string const newMwmPath = diffFile->GetPath(MapOptions::Map);
result = generator::mwm_diff::ApplyDiff(oldMwmPath, newMwmPath, diffPath);
@@ -87,7 +88,11 @@ void Manager::ApplyDiff(ApplyDiffParams && p, std::function<void(bool const resu
{
std::lock_guard<std::mutex> lock(m_mutex);
m_status = Status::NotAvailable;
- // TODO: Log the diff applying error (Downloader_DiffScheme_error (Aloha)).
+
+ GetPlatform().GetMarketingService().SendMarketingEvent(
+ marketing::kDiffSchemeError,
+ {{"type", "patching"},
+ {"error", !isFilePrepared ? "Cannot to prepare file" : "Cannot to apply diff"}});
}
task(result);
diff --git a/storage/diff_scheme/diff_scheme_checker.cpp b/storage/diff_scheme/diff_scheme_checker.cpp
index 86ad927fe4..88564c5bef 100644
--- a/storage/diff_scheme/diff_scheme_checker.cpp
+++ b/storage/diff_scheme/diff_scheme_checker.cpp
@@ -6,6 +6,7 @@
#include "base/logging.hpp"
#include <memory>
+#include <sstream>
#include <string>
#include <unordered_map>
#include <utility>
@@ -125,8 +126,12 @@ NameFileInfoMap Checker::Check(LocalMapsInfo const & info)
}
else
{
- LOG(LINFO, ("Request to diffs server failed. Code =", request.ErrorCode(),
- ", Redirection =", request.WasRedirected()));
+ ostringstream ost;
+ ost << "Request to diffs server failed. Code = " << request.ErrorCode()
+ << ", redirection = " << request.WasRedirected();
+ LOG(LINFO, (ost.str()));
+ GetPlatform().GetMarketingService().SendMarketingEvent(
+ marketing::kDiffSchemeError, {{"type", "network"}, {"error", ost.str()}});
}
return diffs;
diff --git a/storage/storage.cpp b/storage/storage.cpp
index a7e8f28fa0..7d282fad9f 100644
--- a/storage/storage.cpp
+++ b/storage/storage.cpp
@@ -276,7 +276,7 @@ void Storage::RegisterAllLocalMaps(bool enableDiffs)
i = j;
}
-
+
FindAllDiffs(m_dataDir, m_notAppliedDiffs);
if (enableDiffs)
LoadDiffScheme();