Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auto-tx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
auto-tx
Commits
099879ac
Commit
099879ac
authored
5 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Invert if-statement to reduce nesting
parent
5f9dd989
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ATxService/AutoTx.cs
+32
-31
32 additions, 31 deletions
ATxService/AutoTx.cs
with
32 additions
and
31 deletions
ATxService/AutoTx.cs
+
32
−
31
View file @
099879ac
...
...
@@ -808,41 +808,42 @@ namespace ATxService
}
}
if
(
_status
.
CurrentTransferSrc
.
Length
>
0
)
{
if
(
_transferredFiles
.
Count
==
0
)
{
var
msg
=
"FinalizeTransfers: CurrentTransferSrc is set to "
+
$"[
{
_status
.
CurrentTransferSrc
}
], but the list of transferred "
+
"files is empty!\nThis indicates something went wrong during the "
+
"transfer, maybe a local permission problem?"
;
Log
.
Warn
(
msg
);
SendAdminEmail
(
msg
,
"Error Finalizing Transfer!"
);
try
{
var
preserve
=
_status
.
CurrentTransferSrc
.
Replace
(
_config
.
ManagedPath
,
""
)
.
Replace
(
@"\"
,
"___"
);
preserve
=
Path
.
Combine
(
_config
.
ErrorPath
,
preserve
);
var
stale
=
new
DirectoryInfo
(
_status
.
CurrentTransferSrc
);
stale
.
MoveTo
(
preserve
);
Log
.
Warn
(
"Moved stale transfer source to [{0}]!"
,
preserve
);
}
catch
(
Exception
ex
)
{
Log
.
Error
(
"Preserving the stale transfer source [{0}] in [{1}] failed: {2}"
,
_status
.
CurrentTransferSrc
,
_config
.
ErrorPath
,
ex
.
Message
);
}
// reset current transfer variables:
_status
.
CurrentTransferSrc
=
""
;
_status
.
CurrentTransferSize
=
0
;
if
(
_status
.
CurrentTransferSrc
.
Length
<=
0
)
return
;
return
;
if
(
_transferredFiles
.
Count
==
0
)
{
var
msg
=
"FinalizeTransfers: CurrentTransferSrc is set to "
+
$"[
{
_status
.
CurrentTransferSrc
}
], but the list of transferred "
+
"files is empty!\nThis indicates something went wrong during the "
+
"transfer, maybe a local permission problem?"
;
Log
.
Warn
(
msg
);
SendAdminEmail
(
msg
,
"Error Finalizing Transfer!"
);
try
{
var
preserve
=
_status
.
CurrentTransferSrc
.
Replace
(
_config
.
ManagedPath
,
""
)
.
Replace
(
@"\"
,
"___"
);
preserve
=
Path
.
Combine
(
_config
.
ErrorPath
,
preserve
);
var
stale
=
new
DirectoryInfo
(
_status
.
CurrentTransferSrc
);
stale
.
MoveTo
(
preserve
);
Log
.
Warn
(
"Moved stale transfer source to [{0}]!"
,
preserve
);
}
Log
.
Debug
(
"Finalizing transfer, moving local data to grace location..."
);
MoveToGraceLocation
();
SendTransferCompletedMail
();
_status
.
CurrentTransferSrc
=
""
;
// cleanup completed, so reset CurrentTransferSrc
catch
(
Exception
ex
)
{
Log
.
Error
(
"Preserving the stale transfer source [{0}] in [{1}] failed: {2}"
,
_status
.
CurrentTransferSrc
,
_config
.
ErrorPath
,
ex
.
Message
);
}
// reset current transfer variables:
_status
.
CurrentTransferSrc
=
""
;
_status
.
CurrentTransferSize
=
0
;
_transferredFiles
.
Clear
();
// empty the list of transferred files
return
;
}
Log
.
Debug
(
"Finalizing transfer, moving local data to grace location..."
);
MoveToGraceLocation
();
SendTransferCompletedMail
();
_status
.
CurrentTransferSrc
=
""
;
// cleanup completed, so reset CurrentTransferSrc
_status
.
CurrentTransferSize
=
0
;
_transferredFiles
.
Clear
();
// empty the list of transferred files
}
/// <summary>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment