Commit 6f41adbf4a17501e1afab4f8a9c83ddbc242c747
1 parent
63a464a2
Update doc for "Дочекатись синхронізації"
Showing
1 changed file
with
32 additions
and
4 deletions
| ... | ... | @@ -117,13 +117,41 @@ Get Broker Property By Username |
| 117 | 117 | Дочекатись синхронізації з майданчиком |
| 118 | 118 | [Arguments] ${username} |
| 119 | 119 | [Documentation] |
| 120 | - ... Get ${wait_timeout} for specified user and wait | |
| 121 | - ... until that timeout runs out. | |
| 120 | + ... Find out how much time has passed since the procurement was modified | |
| 121 | + ... and store the result in `delta`, | |
| 122 | + ... then get `timeout_on_wait` for ``username``, | |
| 123 | + ... then wait for `sleep` seconds, where: | |
| 124 | + ... | |
| 125 | + ... sleep = timeout_on_wait - delta | |
| 126 | + ... | |
| 127 | + ... Thus, when this keyword is executed several times in a row, | |
| 128 | + ... it will wait for as long as really needed. | |
| 129 | + ... | |
| 130 | + ... Example: | |
| 131 | + ... | |
| 132 | + ... The procurement is modified. | |
| 133 | + ... In 5 seconds, this keyword is called for `viewer`. | |
| 134 | + ... Immediately, this keyword is called for `provider`. | |
| 135 | + ... Timeout for `viewer` is 60. | |
| 136 | + ... Timeout for `provider` is 300. | |
| 137 | + ... First call (for `viewer`) will trigger `Sleep 55`. | |
| 138 | + ... Second call (for `provider`) will trigger `Sleep 235`. | |
| 139 | + ... As a result, the delay will end in 300 seconds | |
| 140 | + ... since last modification date. | |
| 141 | + ... | |
| 142 | + ... Another example (a variation of previous one): | |
| 143 | + ... | |
| 144 | + ... Timeout for `viewer` is 120. | |
| 145 | + ... Timeout for `provider` is 30. | |
| 146 | + ... First call will trigger `Sleep 115`. | |
| 147 | + ... Second call will trigger `Sleep 0`, | |
| 148 | + ... since we have already slept for 120 seconds | |
| 149 | + ... and there is no need to sleep any longer. | |
| 122 | 150 | ${now}= Get Current TZdate |
| 123 | 151 | ${delta}= Subtract Date From Date ${now} ${TENDER['LAST_MODIFICATION_DATE']} |
| 124 | 152 | ${timeout_on_wait}= Get Broker Property By Username ${username} timeout_on_wait |
| 125 | - ${wait_timeout}= Subtract Time From Time ${timeout_on_wait} ${delta} | |
| 126 | - Run Keyword If ${wait_timeout}>0 Sleep ${wait_timeout} | |
| 153 | + ${sleep}= Subtract Time From Time ${timeout_on_wait} ${delta} | |
| 154 | + Run Keyword If ${sleep} > 0 Sleep ${sleep} | |
| 127 | 155 | |
| 128 | 156 | |
| 129 | 157 | Звірити поле тендера | ... | ... |
Please
register
or
login
to post a comment