Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AW-94 - Time estimation for sync finish#70

Merged
theotniel merged 2 commits into
devfrom
AW-94
Jun 15, 2018
Merged

AW-94 - Time estimation for sync finish#70
theotniel merged 2 commits into
devfrom
AW-94

Conversation

@centrys-cristian-ilca
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

@theotniel theotniel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under current circumstances, we are always around 4h behind, because of how the API returns chainBestBlock and NetworkBestBlock
We should ask Yao about the expected return values and why is there such a great difference

public static final int MINUTES_IN_AN_HOUR = 60;
public static final int SYNC_STATUS_DISPLAY_UNIT_LIMIT = 2;

public static String formatSyncStatus(SyncInfoDTO syncInfo) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final

return UNDEFINED;
}

private static String getSyncStatusBySeconds(long seconds) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final

private static final int SECONDS_IN_A_DAY = 86400;
private static final String UNDEFINED = "Undefined";
private static final String UP_TO_DATE = "Up to date";
public static final int HOURS_IN_A_DAY = 24;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these 3 constants can be private

int days = (int) seconds / SECONDS_IN_A_DAY;
String syncStatus = "";
int unitsDisplayed = 0;
if(days > 0 && unitsDisplayed < SYNC_STATUS_DISPLAY_UNIT_LIMIT) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unitsDisplayed < SYNC_STATUS_DISPLAY_UNIT_LIMIT is always true when reaching this point

}
if((int) seconds > 0 && unitsDisplayed < SYNC_STATUS_DISPLAY_UNIT_LIMIT) {
syncStatus += (seconds - minutes * SECONDS_IN_A_MINUTE) + " seconds";
unitsDisplayed++;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incrementation of value is not required

@theotniel
Copy link
Copy Markdown
Contributor

This issue will be merged after the following API issue is resolved:

aionnetwork/aion_api#28

@theotniel theotniel changed the title Time estimation for sync finish AW-94 - Time estimation for sync finish Jun 15, 2018
@theotniel theotniel merged commit 5acc454 into dev Jun 15, 2018
@theotniel theotniel deleted the AW-94 branch June 15, 2018 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants